Submission #912677

#TimeUsernameProblemLanguageResultExecution timeMemory
912677AcanikolicMagnus (COCI18_magnus)C++14
50 / 50
2 ms860 KiB
#include <bits/stdc++.h> #define int long long #define pb push_back #define F first #define S second using namespace std; const int N = 2e5 + 10; const int inf = 1e18; char get_next(char x) { if(x == 'H') return 'O'; if(x == 'O') return 'N'; if(x == 'N') return 'I'; return 'H'; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string s; cin >> s; int n = (int)s.size(); s = '.' + s; int res = 0; char cur = 'H'; for(int i = 1; i <= n; i++) { if(s[i] == cur) { if(s[i] == 'I') res += 1; cur = get_next(cur); } } cout << res; 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...