Advertisement
icatalin

06.03.2017 simulare 2016 XII

Mar 6th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. SUB 2 EX 4
  2.  
  3. #include <iostream>
  4. #include <cstring>
  5.  
  6. using namespace std;
  7.  
  8. int v1[256],v2[256];
  9.  
  10. int main()
  11. {
  12.     char s1[101],s2[101];
  13.  
  14.     cin.getline(s1,256);
  15.     cin.getline(s2,256);
  16.  
  17.     int i;
  18.  
  19.     for (i=0; i<strlen(s1); i++)
  20.                 if (s1[i] >='a' && s1[i]<='z')
  21.             v1[s1[i]]++;
  22.  
  23.     for (i=0; i<strlen(s2); i++)
  24.             if (s2[i] >='a' && s2[i]<='z')
  25.                 v2[s2[i]]++;
  26.  
  27.     for (i=0; i<=255; i++)
  28.         if (v1[i] != v2[i])
  29.         {
  30.             cout<<"NU";
  31.             return 0;
  32.         }
  33.  
  34.     cout<<"DA";
  35.  
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement