2407 - 模拟看病

通过次数

24

提交次数

104

时间限制 : 1 秒
内存限制 : 128 MB

患者到医院看病的顺序是:先排队等候,再看病治疗。要求设计一个算法,模拟病人等候就诊的过程。 其中:“病人到达”用命令“A”(或“a”)表示,“护士让下一位就诊”用“N”(或“n”)表示,“不再接收病人排队”用“S”(或“s”)表示。

输入

A(或a) 病历号 N(或n) S(或s) 其他字符

输出

输出可能有多行:

1, 当输入A或a时,代表病人到院签到不输出。

2,当输入N或N时,叫号看病,输出病人的病历号Visit the patient with number x。如果此时没人,输出no patients

3,当输入S或s时,医院关门,停止接受病人。如果此时还有人在排队,需要将剩余病人的病历号输出 No longer receive the patient queue, following patients

4,当输入为其他字符时,输出Input error!

样例

输入

A
123
n
n
a
124
a
125
x
s

输出

Visit the patient with number 123
no patients
Input error!
No longer receive the patient queue, following patients:124 125