Advertisement
Guest User

Untitled

a guest
Sep 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1.  StringBuilder sb = new StringBuilder();
  2.             string str = Console.ReadLine();
  3.             int i = 0, j = 0;
  4.             while (str[j] == ' ')
  5.                 j++;
  6.             while (j<str.Length)
  7.             {
  8.                 if (str[j] != ' ')
  9.                 {
  10.                     sb.Append(str[j]);
  11.                     j++;
  12.                 }
  13.                 else
  14.                 {
  15.                     while (j < str.Length && str[j] == ' ')
  16.                         j++;
  17.  
  18.                     if(j != str.Length)
  19.                         sb.Append(' ');
  20.                 }
  21.              }
  22.             Console.WriteLine(sb+ "/");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement