编程介的小学生 2017-09-19 04:04 采纳率: 20.5%
浏览 829
已采纳

Chat Rooms

Description

Suppose there are a number of good users using an Internet chat room, which is a shared text chat space. Now there are some bad guys in the Internet who would come to this room and would have no respect or interest in the topic of discussion in the group. They would start typing strings of garbage characters, start unsolicited advertisements of certain URLs or businesses, or paste same string again and again just to disturb others in the room.

When I asked about this problem to Prof Banku (naturally not as smart as Prof Shanku) he suggested the following scheme. Let us define consonants to be all letters in a-z and A-Z except a, e, i, o, u, y, A, E, I, O, U and Y.

A user should be able to send a line to the chat room unless

  • the line has more than 5 consecutive consonants, or

  • the line contains at least one word which has more than 4 consecutive consonants and the user sent more than 2 such lines in last 10 lines sent, or

  • the user sent the same line more than once in last 10 sentences sent.
    Input

Input consists of several lines. The first line contains an integer n, which is the number of lines in the shared text space. Then follow n lines each consisting of not more than 255 ASCII characters.
Output

For each line of input print y if the line is acceptable according to the criteria set above and n otherwise in separate lines. See the sample output for example.
Sample Input

12
hello
how r u?
where r u from?
kjhh kh kgkjhg jhg
where r u from?
i am from London, Ontario, Canada
how r you nxw?
now
where r u from?
kjhh kh kgkjhg jhg
very good
it is very cold here.
Sample Output

y
y
y
n
y
y
y
y
n
n
y
y

  • 写回答

1条回答 默认 最新

  • devmiao 2017-10-04 01:21
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!