hdu 3079 Vowel Counting

题意:元音大写,辅音小写。


#include<iostream>
#include<string>
using namespace std;

int main(){
    int n;
    cin>>n;
    while(n--){
        string str;
        cin>>str;
        // 把大写全部转换成小写
        for(int i=0;i<str.length();i++){
            if(isupper(str[i])){
                str[i] = str[i] - 'A' + 'a';
            }
        }
        // 把元音字母转换成大写
        for(int i=0;i<str.length();i++){
            switch(str[i]){
            case 'a':
            case 'e':
            case 'i':
            case 'o':
            case 'u':
            str[i] = str[i] - 'a' + 'A';
            }
        }
        // 输出结果
        cout<<str<<endl;
    }
    return 0;
}





Vowel Counting

元音统计
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1673    Accepted Submission(s): 1233


Problem Description
The "Vowel-Counting-Word"(VCW), complies with the following conditions.
单词元音计数,简称VCW,遵照下面列出的条件。
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".
例如:“ ApplE ” 的元音计数是“ aPPle "(这个写法是反的),"jUhUA"的元音计数是"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.
输入的第一行包含一个正整数T,他表示测试事件的个数。
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.
 单词的长度不会大于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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值