#include <bits/stdc++.h>   using namespace std;   const int N = 1000;   int main(int argc, char *argv[]) {     string s;     vector<pair<char, int> > count;     int n;     cin >> s;     n = s.size();     for (int i = 0; i < n;) {       int cnt = 0;       int prev = s[i];       while (s[i] == prev) {         cnt++;         i++;       }       count.push_back(make_pair(prev, cnt));     }     for (int i = 0; i < count.size(); i++) {       if (count[i].second >= 3) count[i].second = 2;     }     for (int i = 0; i < count.size() - 1; i++) {       if (count[i].second == 2 && count[i + 1].second == 2)         count[i + 1].second = 1;     }     for (int i = 0; i < count.size(); i++) {       for (int j = 0; j < count[i].second; j++) cout << count[i].first;     }   }   