Vowel Counting |
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) |
Total Submission(s): 2607 Accepted Submission(s): 1422 |
Problem Description The "Vowel-Counting-Word"(VCW), complies with the following conditions. |
Input The first line of the input contains an integer T (T<=20) which means the number of test cases. |
Output For each case, output its Vowel-Counting-Word. |
Sample Input 4 XYz application qwcvb aeioOa |
Sample Output xyz ApplIcAtIOn qwcvb AEIOOA |
Author AppleMan |
Source HDU 2nd “Vegetable-Birds Cup” Programming Open Contest |
Recommend lcy |
思路:水题
1 #include<cstdio> 2 3 int main(int argc, char *argv[]) 4 { 5 char str[55]; 6 int T; 7 scanf("%d",&T); 8 while(T--) 9 { 10 scanf("%s",str); 11 for(int i=0;str[i]!=‘\0‘;i++) 12 { 13 switch(str[i]) 14 { 15 case‘a‘:str[i]-=32;break; 16 case‘e‘:str[i]-=32;break; 17 case‘i‘:str[i]-=32;break; 18 case‘o‘:str[i]-=32;break; 19 case‘u‘:str[i]-=32;break; 20 default:if(str[i]>=‘A‘&&str[i]<=‘Z‘) 21 { 22 if(str[i]!=‘A‘&&str[i]!=‘E‘&&str[i]!=‘I‘&&str[i]!=‘O‘&&str[i]!=‘U‘) 23 str[i]+=32; 24 } 25 } 26 27 } 28 printf("%s\n",str); 29 } 30 return 0; 31 }
时间: 2024-10-08 12:33:02