MuffinMonster

Class Task 57#

Mar 13th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static string Fix(string st)
  11.         {
  12.             while (st.LastIndexOf("  ") != -1)
  13.             {
  14.                 st = st.Replace("  ", " ");
  15.             }
  16.             return st;
  17.         }
  18.         static void Main(string[] args)
  19.         {
  20.             string st = "Hello    world    how    are    you?";
  21.             Console.WriteLine(Fix(st));
  22.             Console.ReadKey();
  23.         }
  24.     }
  25. }
Add Comment
Please, Sign In to add comment