SHARE
TWEET

TripleDigitRot

Teodor92 Dec 30th, 2012 162 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Text;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5.  
  6. class ProblemOne
  7. {
  8.     static void Main()
  9.     {
  10.         string k = Console.ReadLine();
  11.         List<char> number = new List<char>();
  12.         for (int i = 0; i < k.Length; i++)
  13.         {
  14.             number.Add((char)k[i]);
  15.         }
  16.         if (number.Count> 2)
  17.         {
  18.             StringBuilder build = new StringBuilder();
  19.             if (number[number.Count - 3] != '0')
  20.             {
  21.                 build.Append(number[number.Count - 3]);
  22.             }
  23.             if (number[number.Count - 2] != '0')
  24.             {
  25.                 build.Append(number[number.Count - 2]);
  26.             }
  27.             if (number[number.Count - 1] != '0')
  28.             {
  29.                 build.Append(number[number.Count - 1]);
  30.             }
  31.             for (int i = 0; i < number.Count - 3; i++)
  32.             {
  33.                 build.Append(number[i]);
  34.             }
  35.             Console.WriteLine(build.ToString());
  36.         }
  37.         else if(number.Count == 2)
  38.         {
  39.             if (number[1] != '0')
  40.             {
  41.                 Console.Write(number[1]);
  42.             }
  43.             Console.Write(number[0]);
  44.             Console.WriteLine();
  45.         }
  46.         else
  47.         {
  48.             Console.WriteLine(number[0]);
  49.         }
  50.          
  51.  
  52.     }
  53. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top