Post Robot

Problem Description

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!

 1 #include <stdio.h>
 2 #include <string.h>
 3
 4 int main(){
 5     char c;
 6     char s[1000];
 7     int i;
 8     int length;
 9
10     while(scanf("%c",&c)!=EOF){
11         i=0;
12         while(c!=‘\n‘){
13             s[i]=c;
14             i++;
15             c=getchar();
16         }
17         s[i]=‘\0‘;
18         length=strlen(s);
19
20         for(i=0;i<length;i++){
21             if(i+4<length && s[i]==‘A‘ && s[i+1]==‘p‘ && s[i+2]==‘p‘ && s[i+3]==‘l‘ && s[i+4]==‘e‘)
22                 printf("MAI MAI MAI!\n");
23
24             if(i+5<length && s[i]==‘i‘ && s[i+1]==‘P‘ && s[i+2]==‘h‘ && s[i+3]==‘o‘ && s[i+4]==‘n‘ && s[i+5]==‘e‘)
25                 printf("MAI MAI MAI!\n");
26
27             if(i+3<length && s[i]==‘i‘ && s[i+1]==‘P‘ && s[i+2]==‘o‘ && s[i+3]==‘d‘)
28                 printf("MAI MAI MAI!\n");
29
30             if(i+3<length && s[i]==‘i‘ && s[i+1]==‘P‘ && s[i+2]==‘a‘ && s[i+3]==‘d‘)
31                 printf("MAI MAI MAI!\n");
32
33             if(i+3<length && s[i]==‘S‘ && s[i+1]==‘o‘ && s[i+2]==‘n‘ && s[i+3]==‘y‘)
34                 printf("SONY DAFA IS GOOD!\n");
35         }
36
37
38
39
40     }
41     return 0;
42 }
时间: 2024-12-10 16:33:11

Post Robot的相关文章

CodeForces 321 A - Ciel and Robot

[题目链接]:click here~~ [题目大意]:一个robot 机器人 ,可以根据给定的指令行动,给你四种指令,robot初始位置是(0,0),指令一出,robot会重复行动,判断能否在无限行动的情况下经过点(n,m). [解题思路]其实仔细模拟一下,可以发现是有周期的,判断即可,见代码吧~~ 代码: #include <iostream> #include <algorithm> #include <bits/stdc++.h> using namespace

Robot Framework自动化测试(五)--- 开发系统关键字

最近一直在用robot framework 做自动化测试项目,老实说对于习惯直接使用python的情况下,被框在这个工具里各种不爽,当然,使用工具的好处也很多,降低了使用成本与难度:当然,在享受工具带来便利的同时也会受制于工具.对于特定的需求,工具没提供相关的Library和关键字的时候,就只能放弃了. 还好robot framework提供了 Evaluate 关键字,对于Evaluate 关键字的使用等有时间再讲.当robot framework 不能解决需求,我是直接写个.py 程序,通过

Robot Framework + Selenium2环境安装

操作系统环境:Windows XP 安装包: 1. 安装Python Python是一切的基础 版本:python-2.7.6.msi 下载地址:https://www.python.org/downloads/ 2. 安装wxPython wxPython是Python语言的一套GUI图形库:ride需要wxPython的支持 版本:wxPython2.8-win32-unicode-2.8.12.1-py27.exe 下载地址:http://sourceforge.net/projects/

Robot Framework常用关键字介绍

下面关键字全部由 Builtin 库提供,Builtin 为 Robot Framework 标准类库.Builtin库提供常用的关键字 1.log log 关键字就是编程语言里的"print"一样,可以打印任何你想打印的内容. 2.定义变量 通过"Set variable"关键字来定义变量 3.连接对象 "Catenate"关键字可以连接多个信息 加上"SEPARATOR="可以对多个连接的信息进行分割. 4.定义列表 通过

在linux下搭建Robot Framework

在linux下搭建自动化测试框架Robot Framework,可以实现多用户同时登录并进行自动化脚本编写,相互之间没有影响. linux系统:fedora 21 步奏 描述 动作 note 1 Install Python yum install python yum list python  /* can view which python version will be installed */ 2 Install easy_install sudo yum install python-

hdu-5673 Robot(默次金数)

题目链接: Robot Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) 问题描述 有一个机器人位于坐标原点上.每秒钟机器人都可以向右移到一个单位距离,或者在原地不动.如果机器人的当前位置在原点右侧,它同样可以 向左移动单位距离.一系列的移动(左移,右移,原地不动)定义为一个路径.问有多少种不同的路径,使得nn秒后机器人仍然位于坐标原点? 答案可能很大,只需输出答案对1,000,00

HDU 5007 Post Robot

Post Robot Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1306    Accepted Submission(s): 941 Problem Description DT is a big fan of digital products. He writes posts about technological produc

HDU 1036 Robot Motion 深搜

 Description A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are N north (up the page) S south (down the page) E east (t

手术Robot能取代医生吗?

现在,机械自动化已经成为各领域为之神往的大趋势,从工业组装,到智能物流,再到餐饮.银行服务,以及娱乐等等,管理者无不处心积虑地降低成本.提高效率,其中,一个非常重要的手段就是利用机器取代人工.医院,作为社会最重要的功能组织,自然也不会冷眼旁观,事实上,人类医学水平的提升,有很大程度上取决于医学设备的提升,那些X-Ray帮我们照出了很多问题,B超则帮我们检查出了前列腺问题,还有那些不知道有没有用的核磁共振,也收了病人不少钱. "治疗更多的疾病.完成更高难度的手术",一直诱惑着医学从业者,

hdoj 1035 Robot Motion

Robot Motion Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7974    Accepted Submission(s): 3685 Problem Description A robot has been programmed to follow the instructions in its path. Instruct