FSM Problem 9002: Cat Detector

(ONLY FSM/DFA SOLUTIONS ACCEPTED)

(follow htis link for information on FSM submissions)

Description

Design a Finite State Machine (or Deterministic Finite Automaton) that reads a string of characters, printing 'YES' if the characters C, A, and T appear in the stream in that order, but not necessarily consecutively, and printing 'NO' if they don't. Case is not relevant, so 'c' is as good as 'C', etc.

Input Format

The input will consist of an arbitrary sequence of characters terminated by the end-of-file mark.

Output Format

The output shoul;d be a single line containing 'YES' or 'NO'.

Sample Input 1

zzzzCzzzza
zzzzzzz
zzzzzzTzzzzz
zzz

Sample Output 1

YES

Sample Input 2

;szjkf;alknbiurtert

Sample Output 2

NO

End of Problem