Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
更短一些。。。In Reply To:简短 Posted by:zlinhua at 2009-02-27 19:43:16 #include<iostream> using namespace std; int main() { //freopen("input.txt","r",stdin); char key[30]; char str[90]; memset(str,'\0',sizeof(str)); gets(key); gets(str); int i; int n=strlen(str); for(i=0;i<n;i++) { if('a'<=str[i] && str[i]<='z') str[i]=key[int(str[i]-'a')]; if('A'<=str[i] && str[i]<='Z') str[i]=char(key[int(str[i]-'A')]+'A'-'a'); } cout<<str<<endl; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator