#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int k = s.length();
  bool frag = true;
  int count = 0;
  while (frag) {
    int n = s.length();
    for (int i = 0; i < n - 1; i++) {
      if (s[i] == s[i + 1]) {
        s.erase(i, 2);
        count += 2;
        n -= 2;
        if (n == 2) break;
      }
    }
    if (n == 2) break;
    if (n == s.length()) frag = false;
  }
  if (s.length() == 2) {
    if (s[0] == s[1]) k += 2;
  }
  int l = s.length();
  cout << s << endl;
  cout << k - l << endl;
}
