#include <iostream>
#include <string>
using namespace std;

// CAT := "" | "m" + CAT + "e" + CAT + "w"

// s[l..r) が CAT かどうか返す.
bool is_cat(const string& s, int l, int r){
	if( l >= r ) return true;
	if( s[l] != 'm' || s[r-1] != 'w' ) return false;
	
	int k=0, deep = 0;
	for(int i=l+1 ; i < r-1 ; i++ ){
		if( deep == 0 && s[i] == 'e' ){
			k = i;
			break;
		}
		if( s[i] == 'm' ) deep++;
		if( s[i] == 'w' ) deep--;
		if( deep < 0 ) return false;
	}
	return is_cat(s, l+1, k) && is_cat(s, k+1, r-1);
}

int main(){
	string s;
	cin >> s;
	cout << (is_cat(s, 0, s.size())? "Cat" : "Rabbit") << endl;
}
### Prompt

Create a solution in Cpp for the following problem:

Example

Input

mmemewwemeww


Output

Cat

### Response

```cpp
#include <iostream>
#include <string>
using namespace std;

// CAT := "" | "m" + CAT + "e" + CAT + "w"

// s[l..r) が CAT かどうか返す.
bool is_cat(const string& s, int l, int r){
	if( l >= r ) return true;
	if( s[l] != 'm' || s[r-1] != 'w' ) return false;
	
	int k=0, deep = 0;
	for(int i=l+1 ; i < r-1 ; i++ ){
		if( deep == 0 && s[i] == 'e' ){
			k = i;
			break;
		}
		if( s[i] == 'm' ) deep++;
		if( s[i] == 'w' ) deep--;
		if( deep < 0 ) return false;
	}
	return is_cat(s, l+1, k) && is_cat(s, k+1, r-1);
}

int main(){
	string s;
	cin >> s;
	cout << (is_cat(s, 0, s.size())? "Cat" : "Rabbit") << endl;
}
```