Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <string>
- using namespace std;
- int main()
- {
- int n, c = 0, index = 0;
- cin >> n;
- string *arr = new string[n];
- string *result = new string[n];
- for (int i = 0; i<n; i++)
- {
- cin >> arr[i];
- for (int j = 0; j < i; j++)
- if (arr[i] == result[j])
- index++;
- if (index == 0)
- result[c++] = arr[i];
- index = 0;
- }
- for (int i = 0; i < n; i++)
- cout << result[i] << " ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement