T
tiger786
I am new to programming and studying basics in college .Can somebody
write a program on this?
The program should monitor a possibly infinite stream of characters
from the keyboard (standard input). If it detects the sequence "ccc"
it outputs a "0". If it detects the sequence "cdc" 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 ccdcdcccdccc<End Of Input> would produce the
following result: 100
While the following sequence cccdcdccccddcdcdcb<End Of Input> would
produce the following result: 0101
write a program on this?
The program should monitor a possibly infinite stream of characters
from the keyboard (standard input). If it detects the sequence "ccc"
it outputs a "0". If it detects the sequence "cdc" 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 ccdcdcccdccc<End Of Input> would produce the
following result: 100
While the following sequence cccdcdccccddcdcdcb<End Of Input> would
produce the following result: 0101