algorithm training string editing time limit: 1.0s memory limit: 512.0MBThe problem description enters a string (length of <=40 characters) from the keyboard and ends with the character '. '. The editing functions are: 1 D: Delete a character, the command is: D A is a deleted character, for example: D s means the deletion of the character ' s ', if there are multiple ' s ' in the string, then delete the first occurrence.
2 I: Insert a character, the format of the command is: I A1 A2 where A1 is inserted before the specified character, A2 represents the character that will be inserted. For example: I s D means that the character ' d ' is inserted before the specified character ' s ', and there are multiple ' s ' in the Wakahara string, then inserted in front of the last character.
3 R: Replace a character, the command format is: R A1 A2 where A1 is the substituted character, A2 is the replacement character, if there is more than one A1 in the original string should replace all.
In the process of editing, if a changed character does not exist, a prompt message is given. Input format input file stringedit.in A total of two lines, the first behavior of the original string (with '. ' End), the second behavior command (see "Problem description" in the input mode.) Output format output file Stringedit.out A total of one line, for the modified string or output specifies that the character does not exist prompt information. The sample input is a book.
D s sample Output Thi is a book.
D s input and Output sample interpretation command to delete s, the first occurrence in the character s in this, the result is obtained.
Algorithm training string Editing