Problem Description
真正的粉丝,是不需要题目描述的^_^。
Input
第一行输入数据组数T(1≤T≤100)。
接下来T行,每行一个有格式的字符串,详见样例,字符串长度不超过1000。
接下来T行,每行一个有格式的字符串,详见样例,字符串长度不超过1000。
Output
真正的粉丝,就算我不给出输出格式,还是可以AC这道题目。
^_^
^_^
Sample Input
5
I am BigZhuGod?
I am BigZhuGod.
I am BigZhuGod!
I am BigZhuGod!!!
I am BigZhuGod!!!!!
Sample Output
-_- Orz Wow! Wooow! Wooooow!
这题还是比较水的...
但是在ac的过程中遇到了几个小问题...
输入带空格的字符串方法: string s; getline(cin, s) 或者 char s[100]; fgets(s, 100, stdin);
好像其他方法都会忽略空格,然后把空格后面的字符当做下一个字符串...
#include<iostream> #include<string> #include<cstdio> using namespace std; #define maxn 1005 int main(){ int T; cin >> T; T = T+1; while(T--){ string s; getline(cin, s); int len = s.size(); switch(s[len-1]){ case '?' :printf("-_- ");break; case '.' :printf("Orz ");break; case '!' :{ printf("W"); int flag = 0; for(int i=0; i<len; i++){ if(s[i] == '!') flag++; } for(int j=0; j<flag; j++){ printf("o"); } printf("w! "); break; } } } return 0; }