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

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-08-05 04:42:32

Vowel Counting的相关文章

杭电OJ(HDU)-ACMSteps-Chapter Two-《An Easy Task》《Buildings》《decimal system》《Vowel Counting》

http://acm.hdu.edu.cn/game/entry/problem/list.php?chapterid=1§ionid=2 1.2.5 #include<stdio.h> /* 题意:找闰年. if((i%4==0 && i%100!=0) || i%400==0)count++; 3 2005 25 1855 12 2004 10000 2108 1904 43236 */ int main() { int t,y,n; int i,count=0; whil

HDU 3079 Vowel Counting (水)

Vowel Counting Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1413    Accepted Submission(s): 1043 Problem Description The "Vowel-Counting-Word"(VCW), complies with the following conditio

杭电oj 3079 Vowel Counting

Tips:可以先将输入的字符串全部转化为小写字母,然后再将元音字母变为大写,时间复杂度O(n) 1 #include<stdio.h> 2 #include<string.h> 3 #include<ctype.h> 4 int main() 5 { 6 int T; 7 scanf("%d",&T); 8 getchar(); 9 while(T--) 10 { 11 char ch[51]; 12 gets(ch); 13 //先全部变为

HDU 3079 Vowel Counting (水题。。。判断元音)

题意:n个字符串,如果元音就是输出大写,否则输出小写. 析:没啥可说的,只要判断AEIOU就OK了. 代码如下: #include <iostream> #include <cstdio> #include <algorithm> #include <queue> #include <vector> #include <cstring> #include <map> #include <cctype> usin

2016.4.9

今天是4月9号,一天都窝在寝室里面,早上看了逆风笑的视频,笑笑真是高产如母猪哇(笑).他又做了很多游戏解说,因为喜欢,所以能一下子做出那么多吧. 还听了好多歌,李纹的,都挺好听的. 主要是一天没吃饭,下午就去刷hdu的steps去了,果然是太弱了. 4月16号就要校赛网络赛了,就是下周六,然后下下周日就是现场赛了. 想起来陕师大的那次,真是非常后怕啊! 不过今天刷题还是有些收获的,希望这个月可以坚持,以后也要坚持,算是入门! 今天学习的一些知识: 1.排序 (1)使用strtok分割一个字符串

UVA - 12075 Counting Triangles

Description Triangles are polygons with three sides and strictly positive area. Lattice triangles are the triangles all whose vertexes have integer coordinates. In this problem you have to find the number of lattice triangles in anMxN grid. For examp

POJ 2386 Lake Counting 搜索题解

简单的深度搜索就可以了,看见有人说什么使用并查集,那简直是大算法小用了. 因为可以深搜而不用回溯,故此效率就是O(N*M)了. 技巧就是增加一个标志P,每次搜索到池塘,即有W字母,那么就认为搜索到一个池塘了,P值为真. 搜索过的池塘不要重复搜索,故此,每次走过的池塘都改成其他字母,如'@',或者'#',随便一个都可以. 然后8个方向搜索. #include <stdio.h> #include <vector> #include <string.h> #include

Counting Divisors HDU - 6069

Counting Divisors HDU - 6069 题意:给定区间[a,b]和k,求xk有多少因子(x属于[a,b]),求和. 题解:http://blog.csdn.net/zlh_hhhh/article/details/76680641 a.b最大可达到1e12,但是b-a<1e6. 一开始愚蠢的一个一个分解然后去求有多少因子然后求和,范围那么大裸裸的超时啊! 可以枚举素数,对每一个素数,把区间内所有可以分解的进行分解. 最后再求和. 1 #include <bits/stdc++

LightOJ - 1148 Mad Counting(坑)

Mad Counting Time Limit: 500MS   Memory Limit: 32768KB   64bit IO Format: %lld & %llu Submit Status Description Mob was hijacked by the mayor of the Town "TruthTown". Mayor wants Mob to count the total population of the town. Now the naive a