hdu3079——Vowel Counting

原題:ios

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

分析:app

元音——>大寫;;;;;輔音——>小寫ide

原碼:spa

#include<iostream> #include<string.h> #include<ctype.h> #include<stdio.h> using namespace std; int main() {     int n,l,i;     char s[66];     scanf("%d",&n);     while(n--)     {         getchar();         scanf("%s",s);         l=strlen(s);         for(i=0; i<l; i++)         {             if(s[i]>='A'&&s[i]<='Z')             {                 if(s[i]=='A'||s[i]=='I'||s[i]=='E'||s[i]=='O'||s[i]=='U')                     printf("%c",s[i]);                 else printf("%c",tolower(s[i]));             }             else             {                 if(s[i]=='a'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='e')printf("%c",toupper(s[i]));                 else                     printf("%c",s[i]);             }         }         printf("\n");     }     return 0; } 
相關文章
相關標籤/搜索