当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1797:Match the string

题目描述
  Sometimes we need to check that if a given string matches a format string or not. Look at the format string: (a)*(b)+(c)?(f|d), * represents the substring in the brackets before appears any times, if the format string is (ab)* ,then string “ababab” or null string match the format string .And + represents the substring in the brackets appears one or more times, for the format (ab)+ , the null string can’t match the format string. And the ? represents the substring in the brackets before appears none or once , and when you get the symbol |, either the substring s1(left of the symbol | ) appear once, or the substring s2(right of the symbol) appear once, but they don’t appear together. For example, (f|h) represent that either ‘f’ or ‘h’ appears for once.
输入解释
  In the first line, there is N represents the case number. Then N lines follow, in each line, there is a string. The length of each string won’t exceed 100000, and 1<=N<=1000. The letters appear in the string are only lower letters.
输出解释
  The format string is given before and won’t be changed. The format string is (a)*aba((b)?(d)+)?h((f)|(k))+
  For each case, just print “YES” if the input string mathes the format string, or “NO”.
输入样例
4
abahf
aababdddhffkk
babbbdh
aaaaaaaaabahffffffff
输出样例
YES
YES
NO
YES
来自杭电HDUOJ的附加信息
Author wangye
Recommend wangye

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-1797

最后修改于 2020-10-25T22:47:50+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000/1000MS(Java/Others) 65536/32768K(Java/Others)