首页 > 代码库 > Codeforces Round #424 B

Codeforces Round #424 B

 1 #include <stdio.h> 2 #include <string.h> 3 char key[300]; 4 int main () 5 { 6     char b,f[30],l[30],sent[10000]; 7     int i,j,x; 8     scanf("%s",f); 9     scanf("%s",l);10     scanf("%s",sent);11     for(i=0;i<26;i++)12     {13         key[f[i]]=l[i];14         key[f[i]-32]=l[i]-32;15     }16     for(i=0;i<strlen(sent);i++)17     {18         if(key[sent[i]])19             printf("%c",key[sent[i]]);20         else21         {22         23             printf("%c",sent[i]);24         }25     }26     return 0;27     28 }
 1 #include<stdio.h> 2  3 int main() 4 { 5     char a[30],b[30],ch; 6     int i=0; 7     while((a[i]=getchar())!=\n)    i++; 8     i=0; 9     while((b[i]=getchar())!=\n)    i++;10     while((ch=getchar())!=\n)11     {12         if(ch<65)    printf("%c",ch);13         else if(ch<97)14         {15             ch+=32;16             for(i=0;i<26;i++)17                 if(a[i]==ch)18                 {19                     printf("%c",b[i]-32);20                     break;21                 }22         }23         else24             for(i=0;i<26;i++)25                 if(a[i]==ch)26                 {27                     printf("%c",b[i]);28                     break;29                 }    30     }31     return 0;32 }
 1 #include <bits/stdc++.h> 2 using namespace std; 3  4 int main() 5 { 6     char a[10000],c; 7     int i; 8     string s1,s2,s; 9     cin>>s1>>s2>>s;10     for(i=0;i<26;++i)11         a[s1[i]]=s2[i];12     for(i=0;i<s.length();++i)13    {14        if(s[i]>=65&&s[i]<=90)15     {16         c=s[i]+32;17         s[i]=a[c]-32;18     }19     else if(s[i]>=97&&s[i]<=122)20         {21             s[i]=a[s[i]];22         }23    }24     cout<<s;25     return 0;26 }
 1 #include<cstdio> 2 #include<cstring> 3 #include<iostream> 4 using namespace std; 5  6 char s1[33],s2[33],ch[222],s[1111]; 7 int len; 8  9 int main()10 {11     scanf("%s%s%s",s1,s2,s);12     for(int i=0;i<=25;i++)13     {14         ch[s1[i]]=s2[i];15     }16     len=strlen(s);17     for(int i=0;i<len;i++)18     {19         if(s[i]>=A&&s[i]<=Z)20         {21             s[i]+=32;22             s[i]=ch[s[i]]-32;23         }24         else if(s[i]>=a&&s[i]<=z)25             s[i]=ch[s[i]];26         else27             s[i]=s[i];28     }29     printf("%s\n",s);30     return 0;31 }

 

Codeforces Round #424 B