Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace _10.ReplaceATag
- {
- class Program
- {
- static void Main(string[] args)
- {
- string text = Console.ReadLine();
- List<string> result = new List<string>();
- while(text != "end")
- {
- if(text.Contains("<a")&&(text.Contains(">")))
- {
- text = text.Replace("<a", "[URL");
- text = text.Replace(">", "]");
- }
- if (text.Contains("</a") && (text.Contains(">")))
- {
- text = text.Replace("</a", "[/URL");
- text = text.Replace(">", "]");
- }
- result.Add(text);
- text = Console.ReadLine();
- }
- foreach (var item in result)
- {
- Console.WriteLine(item);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment