This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int longest_laugh(string s){
int N = s.size();
int now=0,ans=0;
char c;
for(int i=0;i<N;i++){
if(s[i] == 'a'){
if(now == 0){
now++;
c = 'a';
}
else if(c == 'a'){
now = 1;
}
else{
now++;
c = 'a';
}
}
else if(s[i] == 'h'){
if(now == 0){
now++;
c = 'h';
}
else if(c == 'h'){
now = 1;
}
else{
now++;
c = 'h';
}
}
else{
now = 0;
}
ans = max(ans,now);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |