SHARE
TWEET

Untitled

Dari_ Mar 31st, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top