http://acm.hdu.edu.cn/showproblem.php?pid=4639
统计连续he的数量恰为斐波序列 不同块进行相乘
#include <iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<stdlib.h>
#define mod 10007
using namespace std;
char ss[];
int f[];
int main()
{
int t,i,k,kk=;
cin>>t;
f[] = ;f[] = ;
for(i = ; i <= ; i++)
f[i] = (f[i-]%mod+f[i-]%mod)%mod;
while(t--)
{
cin>>ss;kk++;
k = strlen(ss);
int g = ,s=;
for(i = ; i < k ;i++)
{
if((i+)<k&&ss[i]=='h'&&ss[i+]=='e')
{
g++;
i++;
continue;
}
else if(g!=)
{
s=(s*f[g])%mod;
g=;
}
}
if(g)
s = (s*f[g])%mod;
printf("Case %d: ",kk);
cout<<s<<endl;
}
return ;
}