# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
39795 | ssi7415 | Nizovi (COI14_nizovi) | C++14 | 0 ms | 2180 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string S;
ll ind = 0;
bool first = true;
inline void pc(ll idx) {
cout << "\n" << string(ind, ' ') << S[idx];
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> S;
bool inword = false;
for (ll i = 0; i < S.length(); i++) {
if (S[i] == '}') {
if (inword) inword = false;
ind-=2;
pc(i);
}
else if (S[i] == '{') {
if (first) {
cout << S[i];
first = false;
}
else pc(i);
ind+=2;
}
else if (isalpha(S[i])) {
if (!inword) {
inword = true;
pc(i);
}
else {
cout << S[i];
}
}
else if (S[i] == ',') {
inword = false;
cout << S[i];
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |