Advertisement
Guest User

Untitled

a guest
May 27th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. class CorrectBrackets
  6. {
  7.     static void Main()
  8.     {
  9.         string text = Console.ReadLine();
  10.         StringBuilder result = new StringBuilder();
  11.         string[] textSplitN1 = text.Split(new[] { "<a href=\"", "\">", "</a>" }, StringSplitOptions.None);
  12.         result.Append(textSplitN1[0]);
  13.         for (int i = 1; i < textSplitN1.Length; i += 3)
  14.         {
  15.             result.Append("[");
  16.             result.Append(textSplitN1[i + 1]);
  17.             result.Append("]");
  18.             result.Append("(");
  19.             result.Append(textSplitN1[i]);
  20.             result.Append(")");
  21.             result.Append(textSplitN1[i + 2]);
  22.         }
  23.         Console.WriteLine(result.ToString());
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement