Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream fin("bac.txt");
- int main() {
- int x, last;
- fin >> last;
- int nrap = 1;
- while (fin >> x) {
- if (last == x) {
- nrap++;
- } else {
- if (nrap == 2) {
- cout << last << ' ';
- }
- nrap = 1;
- }
- last = x;
- }
- if (nrap == 2) {
- cout << last << ' ';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement