#include <iostream>
using namespace std;
#include <bits/stdc++.h>
int main() {
int N;
cin>>N;
string str;
cin>>str;
int max=0,count=1;
for(int i=1;i<N;i++)
{
if(str[i]=='a'||str[i]=='h')
{
if(i==0||str[i]==str[i-1]||(str[i-1]!='a'&&str[i-1]!='h'))
{
count=1;
}
else {
count++;
}
if(count>max)
{
max=count;
}
}
else
{
count=0;
}
}
if(str[N-1]=='a'||str[N-1]=='h')
{
max=(max>1?max:1);
}
cout<<max<<endl;
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号