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:06:08
Task:HIIT game
Sender:Ace of Spades
Submission time:2017-05-27 12:06:08
Status:READY
Result:ACCEPTED

Show test data

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:8:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < s.size(); ++i) {
                               ^

Code

#include <bits/stdc++.h>
using namespace std;
int main() {
    string s;
    cin>>s;
    vector<int> v;
    int ans = 0;
    for(int i = 0; i < s.size(); ++i) {
	v.push_back(s[i]);
	if(v.size() >= 4) {
	    if(v[v.size()-1] == 'T' && v[v.size()-2] == 'I' && v[v.size()-3] == 'I' && v[v.size()-4] == 'H') {
		++ans;
		for(int j = 0; j < 4; ++j) v.pop_back();
	    }
	}
    }
    if(ans%2 == 0) {
	cout<<"Maija\n";
    }
    else {
	cout<<"Uolevi\n";
    }
}