标签:
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2757 Accepted Submission(s): 922
#include<string.h>
#include<stdio.h>
int main()
{
char ch[10010];
while(gets(ch))
{
int i,len=strlen(ch),h=0,a=0,p=0,y=0;
for(i=0; i<len; i++)
{
if(ch[i]==‘h‘)
h++;
if(ch[i]==‘a‘&&a<h)
a++;
if(ch[i]==‘p‘&&p/2<a)
p++;
else if(ch[i]==‘y‘&&y<p/2)
y++;
}
printf("%d\n",y);
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/-lgh/p/5003473.html