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>
using namespace std;
int longest_laugh(std::string s)
{
int cnt = 0;
char last = 'z';
int mx = 0;
for (int i = 0; i < (int) s.size(); ++i) {
if ((s[i] == 'a' || s[i] == 'h') && s[i] != last) {
++cnt;
if (last == 'z') last = s[i];
else if (last == 'a') last = 'h';
else last = 'a';
} else {
last = 'z';
mx = max(mx, cnt);
cnt = 0;
}
}
mx = max(mx, cnt);
return mx;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |