Xiang da OJ title address: Portal
A Love LetterTime limit:1000 MS Memory limit:65536 KB
Title Description
Codemonkey finally determined to use a love letter way to the beloved goddess, when he after a few days and nights after writing to know that the Goddess has a lot of words do not like, so he had to have these words deleted. For example: The original is: ILOVEYOU, the Goddess does not like the word is ' LV ', ' O ' then the final love letter to change to Ieyu. The collection of words that girls do not like now S,codemonkey want to know what the love letter will be changed to? s={"HATE", "Shit", "LV", "O", "Fuck", "UGLY", "MM"}
Input
Multiple example input, each sample input a line of love letter, the original text contains only uppercase English letters, the original length of not more than 1000
Output
For each example, if the love letter is deleted then output a line of "loser", or output the remaining content of the love letter
Sample input
Iloveyoumm
Sample output
Ieyuloser
#include <iostream> #include <string> #include <sstream> #include <string.h> #include < Stdio.h> using namespace std; int main () {char c[1002]; while (~SCANF ("%s", &c)) {string s=c; int Len =strlen (c); The int flag;//tag, used to determine if the loop needs to end while (1) {flag=1; int O=s.find ("O"); if (O<s.size ()) {S.erase (S.begin () +o,s.begin () +1+o); flag=0; } int Lv=s.find ("LV"); if (Lv<s.size ()) {S.erase (S.begin () +lv,s.begin () +2+lv); flag=0; } int Hate=s.find ("HATE"); if (Hate<s.size ()) {S.erase (S.begin () +hate,s.begin () +4+hate); flag=0; } int Shit=s.find ("shit"); if (Shit<s.size ()) {S.erase (S.begin () +shit,s.begin () +4+shit); flag=0; } int fuck=s.find ("fuck"); if (Fuck<s.size ()) {S.erase (S.begin () +fuck,s.begin () +4+fuck); flag=0; } int Ugly=s.find ("UGLY"); if (Ugly<s.size ()) {S.erase (S.begin () +ugly,s.begin () +4+ugly); flag=0; } int Mm=s.find ("MM"); if (Mm<s.size ()) {S.erase (S.begin () +mm,s.begin () +2+mm); flag=0; }//used to determine if the loop needs to end if (flag==1) break; } if (S.size () >0) {cout<<s<<endl; printf (""); }else{printf ("loser\n"); }} return 0;}
acm--simulation--Xiang da oj 1184--a love letter--water