[转载] 简单的题都不敢做了.# Programming - 葵花宝典
m*c
1 楼
【 以下文字转载自 JobHunting 讨论区 】
【 原文由 mac 所发表 】
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 would produce the
following result: 100
While the following sequence aaaba
【 原文由 mac 所发表 】
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
following result: 100
While the following sequence aaaba