Vowel Counting |
| Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) |
| Total Submission(s): 2509 Accepted Submission(s): 1367 |
|
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 |
#include<stdio.h>
#include<string.h>
#include<ctype.h> //头文件!
int main(){
int n, i, j, m;
char a[100];
scanf("%d", &n);
for (j = 1; j <= n; j++){
scanf("%s", a);
m = strlen(a) - 1;
for (i = 0; i <= m; i++){
if (a[i] == 'a' || a[i] == 'e' || a[i] == 'i' || a[i] == 'o' || a[i] == 'u')
a[i] = toupper(a[i]); //函数!
if (a[i] >= 'A'&&a[i] <= 'Z')
if (a[i] != 'A'&&a[i] != 'E'&&a[i] != 'I'&&a[i] != 'O'&&a[i] != 'U')
a[i] = tolower(a[i]); //函数!
}
printf("%s\n", a);
}
return 0;
}
本文介绍了一种名为VowelCounting的独特单词转换算法,该算法要求每个元音字母大写,每个辅音字母小写。通过实例演示了如何将普通英文单词转换为其VowelCounting形式。
2850

被折叠的 条评论
为什么被折叠?



