HDU
来源:互联网 发布:试卷出题软件 编辑:程序博客网 时间:2024/06/05 19:05
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.
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.
The size of the article does not exceed 8KB.
Apple bananaiPad lemon ApplepiSony233Tim cook is doubi from AppleiPhoneipadiPhone30 is so biiiiiiig Microsoftmakes good App.
MAI MAI MAI!MAI MAI MAI!MAI MAI MAI!SONY DAFA IS GOOD!MAI MAI MAI!MAI MAI MAI!MAI MAI MAI!
#include<iostream>#include<cstdio>#include<cstring>using namespace std;int main(){ char s[100005]; int l,i; while(gets(s)!=NULL){ // puts(s); l=strlen(s); //printf("l=%d\n",l); for(i=0;i<l;i++){ // printf("i=%d %c",i,s[i]); if(s[i]=='A'&& s[i+1]=='p' && s[i+2]=='p' && s[i+3]=='l' && s[i+4]=='e' ){ printf("MAI MAI MAI!\n"); i+=5; } if(s[i]=='i'&& s[i+1]=='P' && s[i+2]=='o' && s[i+3]=='d'){ printf("MAI MAI MAI!\n"); i+=4; } if(s[i]=='i'&& s[i+1]=='P' && s[i+2]=='a' && s[i+3]=='d'){ printf("MAI MAI MAI!\n"); i+=4; } if(s[i]=='i'&& s[i+1]=='P' && s[i+2]=='h' && s[i+3]=='o' && s[i+4]=='n' &&s[i+5]=='e'){ printf("MAI MAI MAI!\n"); i+=6; } if(s[i]=='S'&& s[i+1]=='o' && s[i+2]=='n' && s[i+3]=='y'){ printf("SONY DAFA IS GOOD!\n"); i+=4; } } } return 0;}
0 0
- hdu
- hdu
- HDU
- hdu ()
- hdu
- hdu
- HDU
- HDU
- hdu
- hdu
- HDU
- Hdu
- hdu
- hdu-
- hdu
- hdu
- hdu
- HDU
- 在一行字符串里查找一个单词
- (转)对冲基金之王科恩,天才还是魔鬼?——读《黑色优势》有感
- mybatis SQL性能调优
- 前端Sass回顾以及Compass入门小记
- 算法导论学习之分治法
- HDU
- 数据结构与算法入门
- C++学习笔记之——友元
- 打造网络营销利器-第3篇--站内链接-网站优化进阶
- 用C++实现的完全二叉树,实现前序遍历,中序遍历,后序遍历。
- Java程序规范
- 每天一个Linux命令(1):ls命令
- 在mybatis执行SQL语句之前进行拦击处理
- 精读前后端渲染之争