while True: try: a=input() b=input() a_='' b_='' for i in a: if i.isdigit(): if i!='9': a_+=str(int(i)+1) else: a_+='0' if i.islower(): if i!='z': a_+=chr(ord(i)+1).upper() else: a_+='A' if i.isupper(): if i!='Z': a_+=chr(ord(i)+1).lower() else: a_+='a' for i in b: if i.isdigit(): if i!='0': b_+=str(int(i)-1) else: b_+='9' if i.islower(): if i!='a': b_+=chr(ord(i)-1).upper() else: b_+='Z' if i.isupper(): if i!='A': b_+=chr(ord(i)-1).lower() else: b_+='z' print(a_) print(b_) except: break
#include <iostream> #include <string> using namespace std; void Encrypt (char aucPassword[], char aucResult[]){ int i; for(i=0;aucPassword[i]!=0;i++){ if(aucPassword[i]>='0' && aucPassword[i]<='9'){ if(aucPassword[i]!='9') aucResult[i]=aucPassword[i]+1; else aucResult[i]='0'; } else if(aucPassword[i]>='a' && aucPassword[i]<='z'){//注意else if的else不能省略 if(aucPassword[i]!='z') aucResult[i]=aucPassword[i]+1-32; else aucResult[i]='A'; } else if(aucPassword[i]>='A' && aucPassword[i]<='Z'){ if(aucPassword[i]!='Z') aucResult[i]=aucPassword[i]+1+32; else aucResult[i]='a'; } else aucResult[i]=aucPassword[i]; } aucResult[i]=0; cout << aucResult << endl; } int unEncrypt (char result[], char password[]){ int i; for(i=0;result[i]!=0;i++){ if(result[i]>='0' && result[i]<='9'){ if(result[i]!='0') password[i]=result[i]-1; else password[i]='9'; } else if(result[i]>='a' && result[i]<='z'){ if(result[i]!='a') password[i]=result[i]-1-32; else password[i]='Z'; } else if(result[i]>='A' && result[i]<='Z'){ if(result[i]!='A') password[i]=result[i]-1+32; else password[i]='z'; } else password[i]=result[i]; } password[i]=0; cout << password << endl; return 0; } int main(){ char s1[100]; char s2[100]; char s3[100]; char s4[100]; /*while(cin.getline(s1,100)) { cin.getline(s3,100); Encrypt(s1,s2); unEncrypt(s3,s4); }*/ char aucPassword[100]; while (cin >> aucPassword){ char aucResult[100],result[100],password[100]; Encrypt (aucPassword, aucResult); cin >> result; int res=unEncrypt (result, password); } return 0; }