Advertisement
Macrovision

Balanced_Parentheses_1

May 24th, 2022 (edited)
838
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string False = "No";
  2. string True = "yes";
  3. while (true)
  4. {
  5.     char[] Text = Console.ReadLine().ToCharArray();
  6.  
  7.     if (Text.Length == 2)
  8.     {
  9.         if (Text[0].Equals('(') && Text[1].Equals(')')) { Console.WriteLine(True); }
  10.         else if (Text[0].Equals('[') && Text[1].Equals(']')) { Console.WriteLine(True); }
  11.         else if  (Text[0].Equals('{') && Text[1].Equals('}')) { Console.WriteLine(True); }
  12.         else Console.WriteLine(False);
  13.     }else if (Text.Length < 2)
  14.         Console.WriteLine(" Few Arguments" + "--> " + Text[0]);
  15.       else
  16.         Console.WriteLine("Too many Arguments "+"--> "+String.Join(" ",Text));
  17.  
  18.  
  19. };
Advertisement
RAW Paste Data Copied
Advertisement