#include <stdio.h>
int main()
{
int n,min;
scanf("%d", &n);
char str[1000007];
int h[26]={0};
scanf("%s", str);
int c0=0,c1=0,flag=0;
for(int i=0;str[i] != '\0';i++)
h[str[i]-'a']++;
int nc=h['c'-'a'];
int nk=h['k'-'a'];
int nt=h['t'-'a'];
if(nc<nk && nc<nt)
min=nc;
else if(nk<nt)
min=nk;
else
min=nt;
if(h['h'-'a']/2 < min )
min=h['h'-'a']/2;
if(h['e'-'a']/2 < min )
min=h['e'-'a']/2;
if(h['r'-'a']/2 < min )
min=h['r'-'a']/2;
if(h['a'-'a']/2 < min )
min=h['a'-'a']/2;
printf("%d",min);
}
No comments:
Post a Comment