Submission #199799

#TimeUsernameProblemLanguageResultExecution timeMemory
199799ahmad_salahMagnus (COCI18_magnus)C++14
50 / 50
6 ms632 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); string s; cin >> s; stack<char> st; while (!s.empty()) { if (st.empty() || st.top() == 'H') { if (s.back() == 'I') st.push('I'); } else { if (st.top() == 'I' && s.back() == 'N') st.push('N'); else if (st.top() == 'N' && s.back() == 'O') st.push('O'); else if (st.top() == 'O' && s.back() == 'H') st.push('H'); } s.pop_back(); } cout << st.size() / 4 << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...