String Replacement Your task is to replace all sub-strings with another. Given string: I like cheese. and substring ike ch, replacement string ove cl, the new string should be: I love cleese. When...


String Replacement<br>Your task is to replace all sub-strings with another.<br>Given string:<br>I like cheese.<br>and substring ike ch, replacement string ove cl, the new string should be:<br>I love cleese.<br>When there are multiple substring matches, all need to be replaced:<br>

Extracted text: String Replacement Your task is to replace all sub-strings with another. Given string: I like cheese. and substring ike ch, replacement string ove cl, the new string should be: I love cleese. When there are multiple substring matches, all need to be replaced: "Monty Python Mnoty Python TYMON Python" Substring: "Python" Replacement: "Silly" Result: "Monty Silly Mnoty Silly TYMON Silly" Input Specification The first line will contain a single integer N (1 < n="">< 10000),="" indicating="" the="" number="" of="" test="" cases.="" each="" test="" case="" will="" occupy="" 3="" lines.="" the="" first="" line="" will="" contain="" the="" original="" string.="" careful,="" there="" may="" be="" whitespaces.="" the="" second="" line="" contains="" the="" substring="" to="" be="" matched="" and="" replaced.="" the="" third="" line="" contains="" the="" replacement="">
Output Specification<br>The output should contain N lines, each line a string, which is the result of replacement.<br>Sample Input 1<br>3<br>I like cheese.<br>ike ch<br>ove cl<br>There is a cheese in the sky.<br>cleese<br>this is silly<br>Monty Python Mnoty Python TYMON Python<br>Python<br>Silly<br>Sample Output<br>I love cleese.<br>There is a cheese in the sky.<br>Monty Silly Mnoty Silly TYMON Silly<br>

Extracted text: Output Specification The output should contain N lines, each line a string, which is the result of replacement. Sample Input 1 3 I like cheese. ike ch ove cl There is a cheese in the sky. cleese this is silly Monty Python Mnoty Python TYMON Python Python Silly Sample Output I love cleese. There is a cheese in the sky. Monty Silly Mnoty Silly TYMON Silly

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here