Advertisement
kxcoze

marina_ggwp

Sep 6th, 2020 (edited)
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <windows.h>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     SetConsoleCP(1251);
  9.     SetConsoleOutputCP(1251);
  10.     setlocale(LC_ALL, "Rus");
  11.     string strArr[100];
  12.     int n;
  13.     cout << "Введите кол-во слов: ";
  14.     cin >> n;
  15.  
  16.     cout << "Введите слова: " << endl;
  17.     for (int i = 0; i < n; i++) {
  18.         cin >> strArr[i];
  19.     }
  20.    
  21.     cout << "\nИзмененные слова: " << endl;
  22.     for (int u = 0; u < n; u++) {
  23.         int mass[100], k = 0, g = strArr[u].size();
  24.         if (strArr[u] != strArr[n - 1]) {
  25.             strArr[u] = strArr[u][g - 1] + strArr[u];
  26.             for (int i = 0; i < g; i++) {
  27.                 for (int j = i+1; j < g; j++) {
  28.                     if (strArr[u][i] == strArr[u][j])
  29.                         mass[k++] = j;
  30.                 }
  31.             }
  32.  
  33.             for (int i = 0; i < g; i++) {
  34.                 bool check = true;
  35.                 for (int j = 0; j < k; j++) {
  36.                     if (i == mass[j]) {
  37.                         check = false;
  38.                         break;
  39.                     }
  40.                 }
  41.  
  42.                 if (check) {
  43.                     cout << strArr[u][i];
  44.                 }
  45.             }
  46.         }
  47.         cout << endl;
  48.     }
  49.  
  50.     return 0;
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement