首页 > 代码库 > hdu4847Wow! Such Doge!

hdu4847Wow! Such Doge!

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4847

水。

 1 #include<cstdio>
 2 #include<cstring>
 3 #include<cctype>
 4 char s[1010];
 5 
 6 int main()
 7 {
 8     int cnt=0;
 9     while(scanf("%s",s)!=EOF)
10     {
11         int n=strlen(s);
12         for(int i=0;i<n;i++)
13             if(isalpha(s[i]))  s[i]=tolower(s[i]);
14        for(int i=0;i+3<n;i++)
15             if(s[i]==d&&s[i+1]==o&&s[i+2]==g&&s[i+3]==e) cnt++;
16     }
17     printf("%d\n",cnt);
18 
19 }

 

hdu4847Wow! Such Doge!