首页 > 代码库 > Vowel Counting
Vowel Counting
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 4XYzapplicationqwcvbaeioOa |
Sample Output xyzApplIcAtIOnqwcvbAEIOOA |
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 }
Vowel Counting
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。