Submission #562793

#TimeUsernameProblemLanguageResultExecution timeMemory
562793silv723Laugh Analysis (IOI16_laugh)C++14
100 / 100
4 ms724 KiB
#include<bits/stdc++.h> using namespace std; using ll=long long; int longest_laugh(string s){ int ans=0; s='z'+s; int now=0; for(int i=1;i<s.size();i++){ if(s[i]!='h'&&s[i]!='a'){ now=0; continue; } if(s[i]==s[i-1]){ now=1; continue; } now++; ans=max(ans,now); } return ans; }

Compilation message (stderr)

laugh.cpp: In function 'int longest_laugh(std::string)':
laugh.cpp:8:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |   for(int i=1;i<s.size();i++){
      |               ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...