Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #define SIZE 256
  3. int main()
  4. {
  5.     int n;
  6.     scanf("%d", &n);
  7.     while (n--)
  8.     {
  9.         int frst[SIZE] = {0}, scnd[SIZE] = {0}, i, flag = 0;
  10.         char tmp;
  11.         while (scanf("%c", &tmp) && tmp != '\n') frst[(int)tmp]++;
  12.         while (scanf("%c", &tmp) && tmp != '\n') scnd[(int)tmp]++;
  13.         for (i = 0; i < SIZE; i++)
  14.         {
  15.             if (frst[i] || scnd[i])
  16.             {
  17.                 if (frst[i] && !scnd[i]) flag++;
  18.                 if (!frst[i] && scnd[i]) flag++;
  19.                 if (scnd[i] < frst[i]) flag++;
  20.             }
  21.         }
  22.         printf("%d: %s\n", i, flag ? "NO" : "YES");
  23.     }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement