# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
598035 | Pyishtell | Laugh Analysis (IOI16_laugh) | C++17 | 4 ms | 596 KiB |
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 "laugh.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int longest_laugh(std::string s){
int count=0;
int ans=0;
for(int i=0; i<s.size()-1; i++){
if(s[i]=='h' && s[i+1]=='a') count++;
else if(s[i]=='a' && s[i+1]=='h') count++;
else{
ans=max(count+1,ans);
count=0;
}
if(s[i]=='h' || s[i]=='a') ans=max(1,ans);
}
if(s[s.size()-1]=='h' || s[s.size()-1]=='a') ans=max(1,ans);
ans=max(count+1,ans);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |