Submission #148406

#TimeUsernameProblemLanguageResultExecution timeMemory
148406Welcome to osu! (#200)HicCup (FXCUP4_hiccup)C++17
24 / 100
21 ms3352 KiB
#include <bits/stdc++.h>
#include "hiccup.h"
using namespace std;

int HicCup(std::string S)
{
    int cnt = 0;
    for(int i=0; i<S.size(); i++){
        if(S[i]=='H') cnt++;
        else cnt--;
        if(cnt<0){
            return -1;
        }
    }
    if(cnt!=0) return -1;
    else return 0;
}

Compilation message (stderr)

hiccup.cpp: In function 'int HicCup(std::__cxx11::string)':
hiccup.cpp:8:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<S.size(); i++){
                  ~^~~~~~~~~
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...