0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 21:16:27 +00:00

CF20A BerOS file system

R40307229
This commit is contained in:
Baoshuo Ren 2020-10-22 21:27:02 +08:00 committed by Baoshuo Ren
parent a308a60ab1
commit 0a16707885
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

27
problem/CF20A/CF20A.cpp Normal file
View File

@ -0,0 +1,27 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
if (s.size() == 1) {
cout << s << endl;
return 0;
}
while (s.size() && *(s.end() - 1) == '/') {
s.erase(s.end() - 1);
}
if (!s.size()) {
cout << "/" << endl;
return 0;
}
for (string::iterator it = s.begin(); it != s.end(); it++) {
if (it + 1 != s.end() && *it == '/' && *(it + 1) == '/') {
s.erase(it + 1);
it--;
}
}
cout << s << endl;
return 0;
}