FSM Problem 9005: ((0+1)(0+1))*+((0+1)(0+1)(0+1))*

(ONLY FSM/DFA SOLUTIONS ACCEPTED)

(follow htis link for information on FSM submissions)

Description

Design a Finite State Machine (or Deterministic Finite Automaton) that recognises strings that match this regular expression:
        ((0+1)(0+1))*+((0+1)(0+1)(0+1))*
(Follow this link for an explanation of regular expressions)

Input Format

The input will be a sequence of lines of characters; each line contains only 0s and 1s, and is terminated by a single \n.

Output Format

For each input line output a single character, 'Y' if the line contains a string that the regular expression could generate, and 'N' if it doesn't.

At the end of the input (when the EOF symbol is reached) print a single \n and stop.

The output for this problem should be a single line, regardless of how many lines of input there are.

Sample Input

1
101
1010111101
10101010111
1010101
111111111111111111111111

Sample Output

NYYNNY

End of Problem