upc组队赛4 Go Latin

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<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define memset(x,y) memset(x,y,sizeof(x))
#define memcpy(x,y) memcpy(x,y,sizeof(y))
#define all(x) x.begin(),x.end()
#define readc(x) scanf("%c",&x)
#define read(x) scanf("%d",&x)
#define read2(x,y) scanf("%d%d",&x,&y)
#define read3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define print(x) printf("%d\n",x)
#define lowbit(x) x&-x
#define lson(x) x<<1
#define rson(x) x<<1|1
#define pb push_back
#define mp make_pair
typedef pair<int,int> P;
typedef long long LL;
typedef long long ll;
const double eps=1e-8;
const double PI = acos(1.0);
const int INF = 0x3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int MOD = 1e9+7;
const ll mod = 998244353;
const int MAXN = 1e6+7;
const int maxm = 1;
const int maxn = 100000+10;
int T;
int n,m;
//char s[100];
string s;
char temp[100];
char cls[500][500];
string dd;
 
int main(){
  cin >> n;
  while(n--){
    cin >> s;
    int len = s.length();
    if(s[len-1] == 'a')  s+='s';
    else if(s[len-1] == 'i' ) {
      s +="os";
    }
    else if(s[len-1] == 'y' ) {
      s[len - 1] = 'i';
      s += "os";
    }
    else if(s[len-1] == 'l' ) {
      s +="es";
    }
    else if(s[len-1] == 'o' ) {
      s +="s";
    }
    else if(s[len-1] == 'r' ) {
      s +="es";
    }
    else if(s[len-1] == 'v' ) {
      s +="es";
    }
    else if(s[len-1] == 'w' ) {
      s +="as";
    }
    else if(s[len-1] == 't' ) {
      s +="as";
    }
    else if(s[len-1] == 'u' ) {
      s += 's';
    }
    else if(s[len-1] == 'n' ) {
      s[len-1] = 'a';
      s +="nes";
    }
    else if(s[len-2] == 'n' && s[len-1] =='e' ) {
      s[len-2] = 'a';
      s[len-1] = 'n';
      s +="es";
    }
    else {
      s+="us";
    }
    cout << s<<endl;
  }
}

转载于:https://www.cnblogs.com/llke/p/10799958.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值