美食节之破译密码得玩偶

描述

There are many interesting things  more than just a lot of food in the Food Festival, such as code-breaking game that Pianyi angel likes playing. Pianyi angel can get one of a kind dolls if she successfully translated the given password into a correct text as the following steps: 


1.The given password is a number string:4194418141634192622374


2.Cut two number as one group 41 94 41 81 41 63 41 92 62 23 74, according to standard Mobile phone. We can get this alphabet:GZGTGOGXNCS


3.Change this alphabet according to the keyboard: QWERTYUIOPASDFGHJKLZXCVBNM = ABCDEFGHIJKLMNOPQRSTUVWXYZ
So ,we can get OTOEOIOUYVL


4.Divide this alphabet to two parts: OTOEOI and OUYVL, compose again.we will get OOTUOYEVOLI


5.Reverse this alphabet the answer will appear : I LOVE YOU TOO


I guess you might worship Pianyi angel as me,so let's Orz her. Now, your task is to translate more number strings.


输入

The input consists of one or more test cases. Each test case consists of a number string(length <= 1000) per line. We ensure all input are legal.

输出

For each test case, output an upper alphabet string per line.

样例输入

4194418141634192622374
41944181416341926223

样例输出

ILOVEYOUTOO
VOYEUOOTIO

#include<iostream>
#include<string>
using namespace std;

string convert4(string a){
    int len=a.length();
    string newa="";
    for(len--;len>=0;len--)
        newa+=a[len];
    return newa;
}

string convert3(string a){
    int len=a.length(),i,j;
    string newa="";
    for(i=0,j=(len-1)/2+1;i<(len-1)/2+1;i++,j++){
        newa+=a[i];
        if(j<len)
            newa+=a[j];
        //cout<<"couvert3:"<<i<<" "<<j<<" "<<newa<<endl;
    }
    return newa;
}

string convert2(string a){
    int len=a.length(),i;
    string newa="";
    for(i=0;i<len;i++){
        switch(a[i]){
        case 'Q':
            newa+='A';break;
        case 'W':
            newa+='B';break;
        case 'E':
            newa+='C';break;
        case 'R':
            newa+='D';break;
        case 'T':
            newa+='E';break;
        case 'Y':
            newa+='F';break;
        case 'U':
            newa+='G';break;
        case 'I':
            newa+='H';break;
        case 'O':
            newa+='I';break;
        case 'P':
            newa+='J';break;
        case 'A':
            newa+='K';break;
        case 'S':
            newa+='L';break;
        case 'D':
            newa+='M';break;
        case 'F':
            newa+='N';break;
        case 'G':
            newa+='O';break;
        case 'H':
            newa+='P';break;
        case 'J':
            newa+='Q';break;
        case 'K':
            newa+='R';break;
        case 'L':
            newa+='S';break;
        case 'Z':
            newa+='T';break;
        case 'X':
            newa+='U';break;
        case 'C':
            newa+='V';break;
        case 'V':
            newa+='W';break;
        case 'B':
            newa+='X';break;
        case 'N':
            newa+='Y';break;
        case 'M':
            newa+='Z';break;
        }
    }
    //cout<<"couvert2:"<<newa<<endl;
    return newa;
}

string convert1(string a){
    int len=a.length(),i;
    string newa="";
    for(i=0;i<=len-2;i+=2){
        switch(a[i]){
        case '2':
            switch(a[i+1]){
            case '1':newa+='A';break;
            case '2':newa+='B';break;
            case '3':newa+='C';break;
            }
            break;
        case '3':
            switch(a[i+1]){
            case '1':newa+='D';break;
            case '2':newa+='E';break;
            case '3':newa+='F';break;
            }
            break;
        case '4':
            switch(a[i+1]){
            case '1':newa+='G';break;
            case '2':newa+='H';break;
            case '3':newa+='I';break;
            }
            break;
        case '5':
            switch(a[i+1]){
            case '1':newa+='J';break;
            case '2':newa+='K';break;
            case '3':newa+='L';break;
            }
            break;
        case '6':
            switch(a[i+1]){
            case '1':newa+='M';break;
            case '2':newa+='N';break;
            case '3':newa+='O';break;
            }
            break;
        case '7':
            switch(a[i+1]){
            case '1':newa+='P';break;
            case '2':newa+='Q';break;
            case '3':newa+='R';break;
            case '4':newa+='S';break;
            }
            break;
        case '8':
            switch(a[i+1]){
            case '1':newa+='T';break;
            case '2':newa+='U';break;
            case '3':newa+='V';break;
            }
            break;
        case '9':
            switch(a[i+1]){
            case '1':newa+='W';break;
            case '2':newa+='X';break;
            case '3':newa+='Y';break;
            case '4':newa+='Z';break;
            }
            break;
        }
    }
    //cout<<"couvert1:"<<newa<<endl;
    return newa;
}

int main(){
    string password;
    while(cin>>password){
        password=convert1(password);
        password=convert2(password);
        password=convert3(password);
        password=convert4(password);
        cout<<password<<endl;
    }
    return 0;
} 


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值