Abbreviation(ZOJ-4105)

Problem Description

In the Test of English as a Foreign Language (TOEFL), the listening part is very important but also very hard for most students since it is usually quite hard for them to remember the whole passage. To help themselves memorize the content, students can write down some necessary details. However, it is not easy to write down the complete word because of its length. That's why we decide to use the abbreviation to express the whole word.

It is very easy to get the abbreviation, all we have to do is to keep the consonant letters and erase the vowel. In the English alphabet, we regard 'a', 'e', 'i', 'y', 'o', 'u' as the vowels and the other letters as the consonants. For example, "subconscious" will be expressed as "sbcnscs".

However, there is one exception: if the vowel appears as the first letter, they should be kept instead of thrown away. For example, "oipotato" should be expressed as "optt".

Since you have learned how to use the abbreviation method, it's time for some exercises. We now present you T words in total, it's your task to express them in their abbreviation form.

Input

There are multiple test cases. The first line of the input contains an integer T (about 100), indicating the number of test cases. For each test case:

The only line contains a string s (1<=|s|<=100) consisting of lowercase English letters, indicating the word which needs to be abbreviated.

Output

For each test case output one line containing one string, which is the correct abbreviation of the given word.

Sample Input

5
subconscious
oipotato
word
symbol
apple

Sample Output

sbcnscs
optt
wrd
smbl
appl

题意:t 组数据,每组给出一个字符串,要求删除字符串中的 a、e、i、o、u、y 并输出,如果这些字母在字首的话不必删除

思路:首字母不必考虑直接输出,然后对剩下的字符暴力枚举即可

Source Program

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 1000+5;
const int dx[] = {0,0,-1,1,-1,-1,1,1};
const int dy[] = {-1,1,0,0,-1,1,-1,1};
using namespace std;
int main() {
    int t;
    scanf("%d",&t);
    while(t--){
        memset(str,'\0',sizeof(str));
        scanf("%s",str);
        printf("%c",str[0]);
        for(int i=1;i<strlen(str);i++){
            if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u'||str[i]=='y')
                continue;
            printf("%c",str[i]);
        }
        printf("\n");
    }
    return 0;
}

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值