Go Latin

题目描述

There are English words that you want to translate them into pseudo-Latin. To change an English word into pseudo-Latin word, you simply change the end of the English word like the following table.

If a word is not ended as it stated in the table, put ‘-us’ at the end of the word. For example, a word “cup” is translated into “cupus” and a word “water” is translated into “wateres”.

Write a program that translates English words into pseudo-Latin words.

 

输入

Your program is to read from standard input. The input starts with a line containing an integer, n (1 ≤ n ≤ 20), where n is the number of English words. In the following n lines, each line contains an English word. Words use only lowercase alphabet letters and each word contains at least 3 and at most 30 letters.

 

输出

Your program is to write to standard output. For an English word, print exactly one pseudo-Latin word in a line.

 

样例输入

复制样例数据

2
toy
engine

样例输出

toios
engianes

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

void ope(string s){
    int l = s.length();
    if(s[l-1] == 'a')
        s+='s';
    else if(s[l-1] == 'i')
        s+="os";
    else if(s[l-1] =='y'){
        s.erase(l-1,1);
        s+="ios";
    }
    else if(s[l-1] == 'l')
        s+="es";
    else if(s[l-1] == 'n'){
        s.erase(l-1,1);
        s+="anes";
    }
    else if(s[l-2]=='n'&&s[l-1]=='e'){
        s.erase(l-2,2);
        s+="anes";
    }
    else if(s[l-1] == 'o')
        s+="s";
    else if(s[l-1] == 'r')
        s+="es";
    else if(s[l-1] == 't')
        s+="as";
    else if(s[l-1] == 'u')
        s+="s";
    else if(s[l-1] == 'v')
        s+="es";
    else if(s[l-1] == 'w')
        s+="as";
    else
        s+="us";
    cout<<s<<endl;
}
int main()
{
    int n;
    string s;
    cin>>n;
    while(n--){
        cin>>s;
        ope(s);
    }

}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值