# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
710057 | ToroTN | Laugh Analysis (IOI16_laugh) | C++14 | 6 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>
//#include "grader.cpp"
using namespace std;
#define pb push_back
int cnt;
map<char,char> mp;
int longest_laugh(std::string s)
{
mp['h']='a';
mp['a']='h';
int ans=0;
for(int i=0;i<s.size();i++)
{
if(s[i]=='h'||s[i]=='a')
{
if(i==0||s[i-1]!='h'&&s[i-1]!='a')
{
cnt=1;
}else
{
if(s[i]==mp[s[i-1]])
{
++cnt;
}else
{
cnt=1;
}
}
}else
{
cnt=0;
}
ans=max(ans,cnt);
}
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... |