Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- char findChar(char keys[], char target){
- char normal[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- int res;
- for(int i=0;i<26;i++){
- if(keys[i]==target){
- return normal[i];
- }
- }
- }
- int main(){
- int tc;
- scanf("%d",&tc);
- for(int i=1;i<=tc;i++){
- int n,m,in,index=0;
- scanf("%d %d",&n,&m);
- char keys[n][27];
- char words[m+1];
- char res[m];
- for(int j=0;j<n;j++){
- scanf("%s",&keys[j]);
- }
- scanf("%s",words);
- for(int j=0;j<m;j++){
- scanf("%d",&in);
- res[j] = findChar(keys[in-1],words[j]);
- }
- printf("Case #%d: ",i);
- for(int j=0;j<m;j++){
- printf("%c",res[j]);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement