#include <iostream>
using namespace std;
bool iscat(string s)
{
  int l = s.length();
  if(l == 0 || s == "mew") return true;
  if(s[0] != 'm' || s[l-1] != 'w' || l % 3 != 0) return false;
  int m = 0,e = 0,w = 0;
  for(int i=0; i<l; i++){
    switch(s[i]){
    case 'm': m++; break;
    case 'e': e++; break;
    case 'w': w++; break;
    }
  }
  if(m != e || e != m) return false;
  int id = 1;
  int n;
  while((n = s.find('e',id)) != string::npos){
    string s1 = s.substr(1,n-1);
    string s2 = s.substr(n+1,l-n-2);
    if(iscat(s1) && iscat(s2)) return true;
    id = n+1;
  }
  return false;
}
int main()
{
  string s;
  cin >> s;
  if(iscat(s)) cout << "Cat" << endl;
  else cout << "Rabbit" << endl;
  return 0;
}
### Prompt

Construct a CPP code solution to the problem outlined:

Example

Input

mmemewwemeww


Output

Cat

### Response

```cpp
#include <iostream>
using namespace std;
bool iscat(string s)
{
  int l = s.length();
  if(l == 0 || s == "mew") return true;
  if(s[0] != 'm' || s[l-1] != 'w' || l % 3 != 0) return false;
  int m = 0,e = 0,w = 0;
  for(int i=0; i<l; i++){
    switch(s[i]){
    case 'm': m++; break;
    case 'e': e++; break;
    case 'w': w++; break;
    }
  }
  if(m != e || e != m) return false;
  int id = 1;
  int n;
  while((n = s.find('e',id)) != string::npos){
    string s1 = s.substr(1,n-1);
    string s2 = s.substr(n+1,l-n-2);
    if(iscat(s1) && iscat(s2)) return true;
    id = n+1;
  }
  return false;
}
int main()
{
  string s;
  cin >> s;
  if(iscat(s)) cout << "Cat" << endl;
  else cout << "Rabbit" << endl;
  return 0;
}
```