Submission #39795

# Submission time Handle Problem Language Result Execution time Memory
39795 2018-01-18T17:34:26 Z ssi7415 Nizovi (COI14_nizovi) C++14
0 / 100
0 ms 2180 KB
#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

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 time Memory Grader output
1 Incorrect 0 ms 2180 KB Unexpected end of file - token expected
2 Incorrect 0 ms 2180 KB Unexpected end of file - token expected
3 Incorrect 0 ms 2180 KB Unexpected end of file - token expected
4 Incorrect 0 ms 2180 KB Unexpected end of file - token expected
5 Incorrect 0 ms 2180 KB Unexpected end of file - token expected
6 Incorrect 0 ms 2180 KB Unexpected end of file - token expected
7 Incorrect 0 ms 2180 KB Unexpected end of file - token expected
8 Incorrect 0 ms 2180 KB Unexpected end of file - token expected
9 Incorrect 0 ms 2180 KB Unexpected end of file - token expected
10 Incorrect 0 ms 2180 KB Unexpected end of file - token expected