码迷,mamicode.com
首页 > 其他好文 > 详细

Vowel Counting

时间:2015-01-25 18:07:23      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:

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                 casea:str[i]-=32;break;
16                 casee:str[i]-=32;break;
17                 casei:str[i]-=32;break;
18                 caseo:str[i]-=32;break;
19                 caseu: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 }
View Code

 

Vowel Counting

标签:

原文地址:http://www.cnblogs.com/GoFly/p/4248428.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!