Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <vector>
- #include <string>
- #include <algorithm>
- #include <stack>
- #include <queue>
- #include <list>
- using namespace std;
- ifstream fin("input.txt");
- int main()
- {
- /*
- 1 2 2 3 3 3 4 4 4 4
- */
- list<int> l;
- while (fin.peek() != EOF)
- {
- int cur;
- fin >> cur;
- if (l.empty())
- l.push_back(cur);
- if (cur != l.back())
- l.push_back(cur);
- }
- while (!l.empty())
- {
- int cur = l.front();
- l.pop_front();
- cout << cur << ' ' ;
- }
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement