Advertisement
allia

словарь

Nov 6th, 2020
1,918
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.   int n, c = 0, index = 0;
  10.   cin >> n;
  11.   string *arr = new string[n];
  12.   string *result = new string[n];
  13.  
  14.   for (int i = 0; i<n; i++)
  15.   {
  16.     cin >> arr[i];
  17.     for (int j = 0; j < i; j++)
  18.      if (arr[i] == result[j])
  19.      index++;
  20.     if (index == 0)
  21.     result[c++] = arr[i];
  22.     index = 0;
  23.   }
  24.  
  25. for (int i = 0; i < n; i++)
  26.  cout << result[i] << " ";
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement