A
Andy Green
Emphasis is on efficiancy and speed this is the excercise:
The program should monitor a possibly infinite stream of characters
from the keyboard (standard input). If it detects the sequence "aaa"
it outputs a "0". If it detects the sequence "aba" it outputs a "1".
DO NOT detect sequences within sequences. The program should exit
cleanly when it detects an End Of Input. For example:
The following sequence aababaaabaaa<End Of Input> would produce the
following result: 100
While the following sequence aaababaaaabbababa<End Of Input> would
produce the following result: 0101
Any takers?
The program should monitor a possibly infinite stream of characters
from the keyboard (standard input). If it detects the sequence "aaa"
it outputs a "0". If it detects the sequence "aba" it outputs a "1".
DO NOT detect sequences within sequences. The program should exit
cleanly when it detects an End Of Input. For example:
The following sequence aababaaabaaa<End Of Input> would produce the
following result: 100
While the following sequence aaababaaaabbababa<End Of Input> would
produce the following result: 0101
Any takers?