#include <bits/stdc++.h>
using namespace std;
signed main() {
  string S;
  cin >> S;
  long long N = (long long)S.size();
  long long ans = 0;
  for (long long i = 1; i < N - ans; i++) {
    if (S.at(i) != S.at(i - 1)) {
      ans += 2;
      S.erase(i - 1, 2);
      i--;
    }
  }
  cout << S << endl;
  cout << ans << endl;
}
