博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Post Robot HDU - 5007
阅读量:4136 次
发布时间:2019-05-25

本文共 1896 字,大约阅读时间需要 6 分钟。

DT is a big fan of digital products. He writes posts about technological products almost everyday in his blog.

But there is such few comments of his posts that he feels depressed all the day. As his best friend and an excellent programmer, DT asked you to help make his blog look more popular. He is so warm that you have no idea how to refuse. But you are unwilling to read all of his boring posts word by word. So you decided to write a script to comment below his posts automatically.

After observation, you found words “Apple” appear everywhere in his posts. After your counting, you concluded that “Apple”, “iPhone”, “iPod”, “iPad” are the most high-frequency words in his blog. Once one of these words were read by your smart script, it will make a comment “MAI MAI MAI!”, and go on reading the post.

In order to make it more funny, you, as a fan of Sony, also want to make some comments about Sony. So you want to add a new rule to the script: make a comment “SONY DAFA IS GOOD!” when “Sony” appears.

Input
A blog article described above, which contains only printable characters(whose ASCII code is between 32 and 127), CR(ASCII code 13, ‘\r’ in C/C++), LF(ASCII code 10, ‘\n’ in C/C++), please process input until EOF. Note all characters are case sensitive.

The size of the article does not exceed 8KB.

Output
Output should contains comments generated by your script, one per line.
Sample Input
Apple bananaiPad lemon ApplepiSony
233
Tim cook is doubi from Apple
iPhoneipad
iPhone30 is so biiiiiiig Microsoft
makes good App.
Sample Output
MAI MAI MAI!
MAI MAI MAI!
MAI MAI MAI!
SONY DAFA IS GOOD!
MAI MAI MAI!
MAI MAI MAI!
MAI MAI MAI!
遇到Apple,iPhone,iPad,iPod就输出MAI MAI MAI!遇到Sony就输出SONY DAFA IS GOOD!
代码如下:

#include
#define ll long longusing namespace std;const int maxx=1e5+100;char s[maxx];int main(){
while(gets(s)) {
int n=strlen(s); for(int i=0;i

努力加油a啊,(o)/~

转载地址:http://gwtvi.baihongyu.com/

你可能感兴趣的文章
Observer模式
查看>>
Iterator模式
查看>>
中国最完整的sysctl.conf优化方案
查看>>
高性能服务器设计
查看>>
性能扩展问题要趁早
查看>>
MySQL-数据库、数据表结构操作(SQL)
查看>>
360在线测试--嵌入式软开
查看>>
优化程序性能—《深入理解计算机系统》
查看>>
《演讲的艺术》有感
查看>>
《亲密关系》摘录
查看>>
win7下安装centOS7双系统
查看>>
Linux鸟哥的私房菜—1
查看>>
matlab 批处理图片
查看>>
每日总结-1
查看>>
python学习之 打包脚本
查看>>
String、String[]、ArrayList<String>之间的转换
查看>>
Java反射机制概念及使用
查看>>
build.gradle 浅析(一)
查看>>
常用校验工具方法汇总
查看>>
AndroidStudio提高编译速度的建议
查看>>