Advertisement
Josif_tepe

Untitled

Dec 23rd, 2020
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. void anagram(char*niza1,char*niza2,int n,int m){
  6.    for(int i=0;i<n;i++){
  7.      for(int j=0;j<m;j++)
  8.    {
  9.        if(niza1[i]==niza2[j]){
  10.      niza2[j]='#';
  11.      break;
  12.        }
  13.      }
  14.     }
  15.     printf("%s\n", niza2);
  16.     for(int j=0;j<m;j++)
  17.     {
  18.         if(niza2[j]!='#'){
  19.         printf("Nizite ne se anagrami");
  20.         return;
  21.     }
  22.     }
  23.     printf("Nizite se anagrami\n");
  24.  
  25.  
  26.  
  27. }
  28.  
  29. int main()
  30. {
  31.     char niza1[101],niza2[101];
  32.     scanf("%s",niza1);
  33.     scanf("%s",niza2);
  34.     anagram(niza1,niza2, strlen(niza1), strlen(niza2));
  35.     return 0;
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement