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:46:17
Task:HIIT game
Sender:Kanadan virallinen maajoukkue
Submission time:2017-05-27 12:46:17
Status:READY
Result:ACCEPTED

Show test data

Compiler report

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

Code

#include<iostream>
#include<queue>
#include<stack>

using namespace std;


int main(){
    stack<char> HITLER;
    string STALIN;
    int MUSSOLINI=0;    
    cin>>STALIN;
    
    for(int i=0; i<STALIN.size(); i++){
        HITLER.push(STALIN[i]);
        if(HITLER.size()>=4){
            char c1,c2,c3,c4;
            c1 = HITLER.top();
            HITLER.pop();
            c2 = HITLER.top();
            HITLER.pop();
            c3 = HITLER.top();
            HITLER.pop();
            c4 = HITLER.top();
            HITLER.pop();
            if(c4 == 'H' && c3 == 'I' && c2 == 'I' && c1 == 'T'){
                MUSSOLINI++;
            }else{
                HITLER.push(c4);
                HITLER.push(c3);
                HITLER.push(c2);
                HITLER.push(c1);
            }
        }
    }
    
    if(MUSSOLINI % 2 == 1){
        cout<<"Uolevi"<<endl;
    }else{
        cout<<"Maija"<<endl;
    }
    return 0;
}