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;
bool check(char c) {
return (c == 'h' || c == 'a');
}
int longest_laugh(std::string s)
{
int n = s.size();
int ans = 0, cur = 0;
for (int i = 0; i < n; i++) {
if (check(s[i])) {
if (!i || !check(s[i - 1]))
cur = 1;
else
cur = (s[i] != s[i - 1] ? cur + 1 : 1);
}
else
cur = 0;
ans = max(ans, cur);
}
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... |