Advertisement
muhata84

Roxettes

Sep 27th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <string.h>
  4. #include <vector>
  5. #include <string>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.  
  12.     char diff;
  13.     char inputstring[10000];
  14.     string s;
  15.     vector<string> dividedString;
  16.  
  17.     cin>>inputstring;
  18.  
  19.     int lend = strlen(inputstring);
  20.     lend--;
  21.     int group = lend/5;
  22.     int first = 0;
  23.     int second = 5;
  24.  
  25.  
  26.  
  27.     for(int j = 0; j < group ; j++)
  28.         {
  29.  
  30.           for(int i = first; i < second; i++)
  31.             {
  32.                 s.push_back(inputstring[i]);
  33.             }
  34.  
  35.         dividedString.push_back(s);
  36.         s = "";
  37.         first += 5;
  38.         second += 5;
  39.  
  40.         }
  41.  
  42.     if(lend < 4)
  43.     {
  44.  
  45.         cout<<inputstring;
  46.    }else
  47.     {
  48.          for(int i = 0;i < group;i++)
  49.         {
  50.         int cnt = 0;
  51.         for(int j = 0;j < group ;j++)
  52.             {
  53.             if(dividedString[i] == dividedString[j])
  54.                 cnt++;
  55.             }
  56.             if(cnt == 1)
  57.             {//its unique..print it
  58.             cout << dividedString[i] <<endl;
  59.             }
  60.  
  61.         }
  62.     }
  63.  
  64.  
  65.        // for(int j = 0; j < group ; j++)
  66.       //  {
  67.      //   cout<<dividedString[j]<<endl;
  68.      //   }
  69.  
  70.  
  71.  
  72.  
  73.     return 0;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement