标签:
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.
Each vowel in the word must be uppercase. Each consonant (the letters except the vowels) must be lowercase. For example, "ApplE" is the VCW of "aPPle", "jUhUA" is the VCW of "Juhua". Give you some words; your task is to get the "Vowel-Counting-Word" of each word. |
Input
The first line of the input contains an integer T (T<=20) which means the number of test cases.
For each case, there is a line contains the word (only contains uppercase and lowercase). The length of the word is not greater than 50. |
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 }
标签:
原文地址:http://www.cnblogs.com/GoFly/p/4248428.html