#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  int N = S.size();
  bool ok = true;
  stack<pair<char, int>> st;
  st.push(make_pair('$', 0));
  for (int i = 0; i < N; i++){
    if (S[i] == 'm'){
      st.push(make_pair('m', 0));
    }
    if (S[i] == 'e'){
      if (st.top().first != 'm' || st.top().second >= 2){
        ok = false;
        break;
      }
      st.top() = make_pair('e', 0);
    }
    if (S[i] == 'w'){
      if (st.top().first != 'e' || st.top().second >= 2){
        ok = false;
        break;
      }
      st.pop();
      st.top().second++;
    }
  }
  if (st.top() != make_pair('$', 1)){
    ok = false;
  }
  if (ok){
    cout << "Cat" << endl;
  } else {
    cout << "Rabbit" << endl;
  }
}

### Prompt

Please formulate a CPP solution to the following problem:

Example

Input

mmemewwemeww


Output

Cat

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  int N = S.size();
  bool ok = true;
  stack<pair<char, int>> st;
  st.push(make_pair('$', 0));
  for (int i = 0; i < N; i++){
    if (S[i] == 'm'){
      st.push(make_pair('m', 0));
    }
    if (S[i] == 'e'){
      if (st.top().first != 'm' || st.top().second >= 2){
        ok = false;
        break;
      }
      st.top() = make_pair('e', 0);
    }
    if (S[i] == 'w'){
      if (st.top().first != 'e' || st.top().second >= 2){
        ok = false;
        break;
      }
      st.pop();
      st.top().second++;
    }
  }
  if (st.top() != make_pair('$', 1)){
    ok = false;
  }
  if (ok){
    cout << "Cat" << endl;
  } else {
    cout << "Rabbit" << endl;
  }
}

```