# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1232399 | countless | Laugh Analysis (IOI16_laugh) | C++20 | 2 ms | 584 KiB |
#include "laugh.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define sp <<" "<<
#define endl "\n"
int longest_laugh(string s) {
int n = s.size();
int mx = 0, curr = 0;
for (int i = 0; i < n; i++) {
if (s[i] == 'h' or s[i] == 'a') {
if (i > 0 and s[i] != s[i-1]) {
curr++;
} else {
mx = max(mx, curr);
curr = 1;
}
} else {
mx = max(mx, curr);
curr = 0;
}
}
return max(mx, curr);
}
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... |