/*
Question:
The following three syntaxes are correct:
1. A single word, P to Z, uppercase letters: N, C, D, E, I
2. If the string S is correctly written, the NS is also correct.
3. If the string S, T is correct, then Cst, DST, EST, and ist are also correct.
Analysis:
Recursive string. If the length of the current string is 1, which complies with Syntax 1, the return value is correct. If the length is greater than 1,
If the current initial character is n and the recursion starts from the second digit, if the string is successful, return success. When the first letter is C, D, E, I,
If the string can be divided into three parts X (c, d, e, I), S, T, return success.
The string factorization function can use the substr function in the string, for example:
S = "12345"
S. substr( 1) = "2345 ";
S. substr (2) = "345 ";
*/
# Include <iostream>
# Include <string>
# Include <cstdio>
Using namespace STD;
Bool DFS (string S)
{
Int Len = S. Size ();
If (LEN = 1)
{
If (S [0]> = 'P' & S [0] <= 'Z ') | s [0] = 'n' | s [0] = 'C' | s [0] = 'D' | s [0] = = 'E' | s [0] = 'I ')
Return true;
Else
Return false;
}
If (s [0] = 'n ')
{
If (DFS (S. substr (1 )))
Return true;
Else
Return false;
}
If (s [0] = 'C' | s [0] = 'D' | s [0] = 'E' | s [0] = = 'I ')
{
If (LEN = 2)
Return false;
String temp;
For (INT I = 0; I <len-1; I ++)
{
Temp = temp + s [I];
If (DFS (temp. substr (1) & DFS (S. substr (I + 1 )))
Return true;
}
}
Return false;
}
Int main ()
{
Freopen ("sum. In", "r", stdin );
Freopen ("sum. Out", "W", stdout );
String S;
While (CIN> S)
{
If (DFS (s ))
Printf ("Yes \ n ");
Else
Printf ("NO \ n ");
}
Return 0;
}