问题 F: good string

问题 F: good string

时间限制: 1 Sec  内存限制: 128 MB
提交: 159  解决: 21
[状态] [讨论版] [提交] [命题人:]
题目描述

给定一个字符串,判断它是否是good string

good string定义为:

字符sgood string,字符pgood string,字符y也是good string

PQ都是good string,则PQgood string

Pgood string,则(P)good string

Pgood string,则!Pgood string

PQ都是good string,则P|QP&Qgood string

输入

输入包含多组数据。每组数据为一行字符串,长度不超过100

输出

对于每组数据,如果Pgood string则输出"P is a good string",否则输出"P is not a good string"

样例输入 Copy
!spy
!(s|p!y)
)sp|y
样例输出 Copy
!spy is a good string
!(s|p!y) is a good string
)sp|y is not a good string