TZOJ:1008: University

真的是有史以来写的最无聊的题!

描述

在大学里,很多单词都是一词多义,偶尔在文章里还要用引申义。这困扰Redraiment很长的时间。

他开始搜集那些单词的所有意义。他发现了一些规律,例如

'a'能用'e'来代替, 'c'能用'f'来代替......
现在他给出了字母的替换规则,如下所示,A被E替换,B被C替换,依次类推。
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
E C F A J K L B D G H I V W Z Y M N O P Q R S T U X
a b c d e f g h i j k l m n o p q r s t u v w x y z
e r w q t y g h b n u i o p s j k d l f a z x c v m

输入

本题包括多组测试数据。

每组测试数据为一行:为仅由字母和空格组成的字符串(空格不变),长度不超过1000个字符。
输入以单行'#'结束。

输出

对应每组测试数据,替换后输出它的引申义。

样例输入

Ilttabaje zaujljg
#

样例输出

Different meaning

#include <iostream>
#include <cstring>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;

char move(char s) // 又臭又长,有没规律(-_-)
{
    if(s == 'A') return 'E';
    else if(s == 'B') return 'C';
    else if(s == 'C') return 'F';
    else if(s == 'D') return 'A';
    else if(s == 'E') return 'J';
    else if(s == 'F') return 'K';
    else if(s == 'G') return 'L';
    else if(s == 'H') return 'B';
    else if(s == 'I') return 'D';
    else if(s == 'J') return 'G';
    else if(s == 'K') return 'H';
    else if(s == 'L') return 'I';
    else if(s == 'M') return 'V';
    else if(s == 'N') return 'W';
    else if(s == 'O') return 'Z';
    else if(s == 'P') return 'Y';
    else if(s == 'Q') return 'M';
    else if(s == 'R') return 'N';
    else if(s == 'S') return 'O';
    else if(s == 'T') return 'P';
    else if(s == 'U') return 'Q';
    else if(s == 'V') return 'R';
    else if(s == 'W') return 'S';
    else if(s == 'X') return 'T';
    else if(s == 'Y') return 'U';
    else if(s == 'Z') return 'X';
    
    else if(s == 'a') return 'e';
    else if(s == 'b') return 'r';
    else if(s == 'c') return 'w';
    else if(s == 'd') return 'q';
    else if(s == 'e') return 't';
    else if(s == 'f') return 'y';
    else if(s == 'g') return 'g';
    else if(s == 'h') return 'h';
    else if(s == 'i') return 'b';
    else if(s == 'j') return 'n';
    else if(s == 'k') return 'u';
    else if(s == 'l') return 'i';
    else if(s == 'm') return 'o';
    else if(s == 'n') return 'p';
    else if(s == 'o') return 's';
    else if(s == 'p') return 'j';
    else if(s == 'q') return 'k';
    else if(s == 'r') return 'd';
    else if(s == 's') return 'l';
    else if(s == 't') return 'f';
    else if(s == 'u') return 'a';
    else if(s == 'v') return 'z';
    else if(s == 'w') return 'x';
    else if(s == 'x') return 'c';
    else if(s == 'y') return 'v';
    else if(s == 'z') return 'm';
    else return ' ';
    
}

int main()
{
    char s[1010];
    while(gets(s) != NULL)
    {
        if(s[0] == '#') break;
        for (int i = 0; i < strlen(s); i ++ )
            cout << move(s[i]);
		cout << endl; // 别忘记换行
    return 0;
}
  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值