Submission #39795

#TimeUsernameProblemLanguageResultExecution timeMemory
39795ssi7415Nizovi (COI14_nizovi)C++14
0 / 100
0 ms2180 KiB
#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)

nizovi.cpp: In function 'int main()':
nizovi.cpp:19:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (ll i = 0; i < S.length(); i++) {
                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...