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.

Go Latin

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

Go Latin

#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);
    }

}