#include <bits/stdc++.h>
using namespace std;

string S;
int mem[501][501];

bool isCat(int l, int r) {
  int &res = mem[l][r];
  if(res != -1) return res;
  if(r - l == 0) return res = true;
  if(S[l] != 'm' || S[r-1] != 'w') return res = false;
  for(int i = l + 1; i < r - 1; ++i) {
    if(S[i] == 'e' && isCat(l + 1, i) && isCat(i + 1, r - 1) ){
      return res = true;
    }
  }
  return res = false;
}

int main() {
  cin >> S;
  memset(mem, -1, sizeof(mem));
  cout << (isCat(0, S.size()) ? "Cat" : "Rabbit") << endl;
  return 0;
}
### Prompt

Create a solution in cpp for the following problem:

Example

Input

mmemewwemeww


Output

Cat

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;

string S;
int mem[501][501];

bool isCat(int l, int r) {
  int &res = mem[l][r];
  if(res != -1) return res;
  if(r - l == 0) return res = true;
  if(S[l] != 'm' || S[r-1] != 'w') return res = false;
  for(int i = l + 1; i < r - 1; ++i) {
    if(S[i] == 'e' && isCat(l + 1, i) && isCat(i + 1, r - 1) ){
      return res = true;
    }
  }
  return res = false;
}

int main() {
  cin >> S;
  memset(mem, -1, sizeof(mem));
  cout << (isCat(0, S.size()) ? "Cat" : "Rabbit") << endl;
  return 0;
}
```