FSM Problem 9001: Triplicity
(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 stream of decimal integers, and prints out their values
modulo 3.
Input Format
The input will consist of a sequence of numbers, one per line.
There will be no characters other than decimal digits on any line,
and each line is properly terminated with a \n character.
Output Format
For each input number, output one line, containing the number's
value modulo 3.
Sample Input
1
2
3
123
124
125
7536963016481138
Sample Output
1
2
0
0
1
2
2
End of Problem