代码求调
查看原帖
代码求调
755412
DPG_DPG123楼主2023/6/18 14:55
# include <iostream>
using namespace std;
int main(){
    string a;
    long long first=0;
    cin >> a;
    int i = 0;
    while (a[i] == '/')
        first ++,i++;
    for (int i = 0;i < a.size();i ++){
        if (a[i] != '/'){
            cout << a[i];
        }
        else{
            while (a[i] == '/')
                i ++;
            //cout << "to"<< i << endl;
            cout << '/' << a[i];
        }
    }
    if (first == 1)
        cout << '/';
    return 0;
}
2023/6/18 14:55
加载中...