SHARE
TWEET

Untitled

a guest Nov 20th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include<cstring>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     char s[201],cuv[20],aux,cuv1[20];
  8.     int i=0,k=0,j=0,k1=1,m,l;
  9.     cout<<"s=";
  10.     cin.getline(s,201);
  11.     while(s[i]!=' ')
  12.     {
  13.         cuv[k]=s[i];
  14.         i++;
  15.         k++;
  16.     }
  17.     cuv[k]='\0';
  18.     for(m=0; m<strlen(cuv)-1; m++)
  19.         for(l=m+1; l<strlen(cuv); l++)
  20.             if(cuv[m]>cuv[l])
  21.             {
  22.                 aux=cuv[m];
  23.                 cuv[m]=cuv[l];
  24.                 cuv[l]=aux;
  25.  
  26.             }
  27.     i=j=i+1;
  28.     while(j<strlen(s))
  29.     {
  30.         k=0;
  31.         while(s[j]!=' '&&s[j]!='\0')
  32.         {
  33.             cuv1[k]=s[j];
  34.             k++;
  35.             j++;
  36.         }
  37.         cuv1[k]='\0';
  38.         for(m=0; m<k-1; m++)
  39.             for(l=i+1; l<k; l++)
  40.                 if(cuv1[m]>cuv1[l])
  41.                 {
  42.                     aux=cuv1[m];
  43.                     cuv1[m]=cuv1[l];
  44.                     cuv1[l]=aux;
  45.                 }
  46.         if(strcmp(cuv,cuv1)==0)
  47.             k1++;
  48.         strcpy(cuv1,cuv1+strlen(cuv1));
  49.         i=j=j+1;
  50.     }
  51.     cout<<k1;
  52.     return 0;
  53. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top