Code Submission Evaluation System Login

CSES - HIIT Open 2017

HIIT Open 2017

Contest start:2017-05-27 11:00:00
Contest end:2017-05-27 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard


History
2017-05-27 12:09:34
Task:HIIT game
Sender:HIIT AND RUN
Submission time:2017-05-27 12:09:34
Status:READY
Result:ACCEPTED

Show test data

Code

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
    ios_base::sync_with_stdio(0);

    string s;
    cin >> s;
    ll n = s.size();
    
    // hiits
    ll ans = 0;
    
    string obj = "HIIT";
    
    string curr(s);
    int ind = 0; 
    
    for(int i = 0; i < n; i++) {
        curr[ind] = s[i];
        ind++;
        
        //cout << curr.substr(ind - 4, 4) << endl;
        
        if (ind >= 4 && curr.substr(ind - 4, 4) == obj) {
            ans++;
            ind -= 4;
        }

    }
    
    if (ans % 2 == 0) cout << "Maija" << endl;
    else cout << "Uolevi" << endl;
    
}