Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- private static void Main()
- {
- string TEXT = Console.ReadLine();
- StringBuilder total = new StringBuilder();
- for (int i = 1; i < TEXT.Length; i++)
- {
- char previousChar = TEXT[i - 1];
- char followingChar = TEXT[i];
- if (char.IsPunctuation(previousChar) && char.IsLetterOrDigit(followingChar))
- {
- total.Append(previousChar + " ");
- }
- else total.Append(previousChar);
- /* if ((char.IsLetterOrDigit(previousChar) && char.IsWhiteSpace(followingChar)))
- {
- total.Replace(" ", "");
- }
- */
- }
- total.Append(TEXT[TEXT.Length - 1]);
- string correctText = total.ToString();
- Console.WriteLine(correctText);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment