Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***
- Author : Shakib Haris
- Started On : 15 January, 2017
- */
- using System;
- class Program {
- public static void Main (string[] args) {
- string tag;
- string rep, repCopy;
- string line, lineCopy;
- int end, idx;
- while ((tag = Console .ReadLine ( )) != null) {
- tag = tag .ToLower ( );
- rep = Console .ReadLine ( );
- repCopy = rep .ToLower ( );
- line = Console .ReadLine ( );
- lineCopy = line .ToLower ( );
- for (int i = 0; i < line .Length; i++) {
- if (lineCopy[i] == '<') {
- end = lineCopy .IndexOf ('>', i);
- idx = lineCopy .IndexOf (tag, i);
- while (idx != -1 && idx < end) {
- lineCopy = lineCopy .Substring (0, idx) + repCopy + lineCopy .Substring (idx + tag .Length);
- line = line .Substring (0, idx) + rep + line .Substring (idx + tag .Length);
- end = lineCopy .IndexOf ('>', i);
- idx = lineCopy .IndexOf (tag, i);
- }
- }
- }
- Console .WriteLine (line);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement