#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<stack>
#include<queue>
#include<string.h>
#include<array>
#include<algorithm>
#include<cmath>
using namespace std;
#define int long long
const int maxn = 5e5;
const int oo = 1e18;
int longest_laugh(string s){
int cur = 0;
int n = s.size();
vector<int> T(n);
for(int i = 0; i < n; i++){
if(s[i] == 'h'){
T[i] = 1;
}
else if(s[i] == 'a'){
T[i] = 1;
}
}
for(int i = 1; i < n; i++){
if(s[i - 1] == 'h' && s[i] == 'a'){
T[i] = T[i - 1] + 1;
}
else if(s[i - 1] == 'a' && s[i] == 'h'){
T[i] = T[i - 1] + 1;
}
}
int mx = -1;
for(int i = 0; i < n; i++){
mx = max(mx, T[i]);
}
return mx;
}
// signed main() {
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// string s;
// cin >> s;
// cout << longest_laugh(s);
// }