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 <vector>
#include <string>
using namespace std;
int longest_laugh(string s)
{
int ans = 0;
int temp = 0;
int n = s.size();
for (int i = 0; i < n; i++) {
if (s[i] == 'a') {
if (i != 0 && s[i-1] == 'h')
temp++;
else
temp = 1;
}
else if (s[i] == 'h') {
if (i != 0 && s[i-1] == 'a')
temp++;
else
temp = 1;
}
else temp = 0;
ans = max(ans, temp);
}
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... |