Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- #include <algorithm>
- #include <map>
- #include <stack>
- #include <set>
- #include <queue>
- #include <fstream>
- #include <sstream>
- using namespace std;
- int main() {
- ifstream in ("input.txt");
- ofstream out ("output.txt");
- vector <pair<string, int> > a;
- vector <string> aa;
- while(in.peek() != EOF)
- {
- string str;
- in >> str;
- a.push_back(make_pair(str, 0));
- aa.push_back(str);
- }
- for (int j = 0; j < a.size(); j++)
- {
- a[j].second = j + 1;
- for (int i = j + 1; i < a.size(); i++)
- if (a[i].first == a[j].first)
- a.erase(a.begin() + i);
- }
- for (int k = 0; k < aa.size(); k++)
- for (int j = 0; j < a.size(); j++)
- {
- if (aa[k] == a[j].first)
- out << a[j].second << " ";
- }
- in.close();
- out.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement