Advertisement
Dari_

Untitled

Mar 31st, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.83 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<string.h>
  4.  
  5. int main(void)
  6. {
  7.     char first[256], sec[256];
  8.     fgets(first, 256, stdin);
  9.     fgets(sec, 256, stdin);
  10.     if (strlen(first) == strlen(sec))
  11.     {
  12.         int n;
  13.         scanf("%d", &n);
  14.         int length = strlen(first);
  15.         char line[256];
  16.         fgets(line, 256, stdin);
  17.  
  18.         for (int i = 0; i < n; i++)
  19.         {
  20.             fgets(line, 256, stdin);
  21.             int len_l = strlen(line);
  22.             for (int j = 0; j < len_l; j++)
  23.             {
  24.                 int k = length - 1;
  25.                 while ((line[j] != first[k]) && (k >= 0))
  26.                     k--;
  27.                 if (k < 0)
  28.                     printf("%c", line[j]);
  29.                 else
  30.                     printf("%c", sec[k]);
  31.             }
  32.         }
  33.     }
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement