Seal_of_approval

Pr8R2ex5

Oct 2nd, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.40 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3.  
  4. namespace test
  5. {
  6.     class Program
  7.     {
  8.         static void Main()
  9.         {
  10.             string a = Console.ReadLine ();
  11.             StringBuilder str = new StringBuilder (a);
  12.             int n = str.Length;
  13.             if (n % 2 == 0) {
  14.                 int idx = n / 2 - 1;
  15.                 str.Remove (idx, 2);
  16.             } else {
  17.                 int idx = n / 2;
  18.                 str.Remove (idx, 1);
  19.             }
  20.             Console.WriteLine ("New string = {0}", str);
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment