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 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

解题思路:水题一枚,字符大小写转化问题。

AC代码:

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

int main(){
//    freopen("in.txt", "r", stdin);
    int t;
    string s;
    while(scanf("%d", &t)!=EOF){
        cin>>s;
        for(int i=0; i<s.size(); i++){
            if(s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u' || s[i] == 'A' || s[i] == 'E' || s[i] == 'I' || s[i] == 'O' || s[i] == 'U'){
                if(s[i]>='a' && s[i]<='z')  s[i] -= 32;
                printf("%c", s[i]);
            }
            else{
                if(s[i]>='A' && s[i]<='Z')  s[i] += 32;
                printf("%c", s[i]);
            }
        }
        printf("\n");
    }
    return 0;
}
时间: 2024-10-07 14:24:07

HDU 3079 Vowel Counting (水)的相关文章

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

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

杭电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 //先全部变为

杭电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

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.E

简单的dp hdu 数塔(水题)

数塔 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 21314    Accepted Submission(s): 12808 Problem Description 在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的: 有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少

hdu 2053 Switch Game 水题一枚,鉴定完毕

Switch Game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10200    Accepted Submission(s): 6175 Problem Description There are many lamps in a line. All of them are off at first. A series of op

HDU 2090 算菜价 --- 水题

/* HDU 2090 算菜价 --- 水题 */ #include <cstdio> int main() { char s[105]; double a, b, sum = 0; while (scanf("%s", s)==1){ scanf("%lf%lf", &a, &b); a *= b; sum += a; } printf("%.1f\n", sum); return 0; }

HDU 2091 空心三角形 --- 水题

/* HDU 2091 空心三角形 --- 水题 */ #include <cstdio> int main() { int kase = 0; char ch; int h, t; //h表示高 while (scanf("%c", &ch) == 1 && ch != '@'){ scanf("%d", &h); if (kase++){ printf("\n"); } getchar(); if

Hdu 5439 Aggregated Counting (2015长春网络赛 ACM/ICPC Asia Regional Changchun Online 找规律)

题目链接: Hdu 5439 Aggregated Counting 题目描述: 刚开始给一个1,序列a是由a[i]个i组成,最后1就变成了1,2,2,3,3,4,4,4,5,5,5.......,最后问a[i]==n(i最大)时候,i最后一次出现的下标是多少? 解题思路: 问题可以转化为求a[i] == n (i最大),数列前i项的和为多少. index: 1 2 3 4 5 6 7 8 9 10 a:        1 2 2 3 3 4 4 4 5 5 可以观察出:ans[1] = 1,