Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _03.NMS
- {
- public class NaturalMessagingService
- {
- public static void Main()
- {
- string line;
- var sb = new StringBuilder();
- var currentChar = '\0';
- while ((line = Console.ReadLine()) != "---NMS SEND---")
- {
- string lineToLower = line.ToLower();
- for (int i = 0; i < lineToLower.Length; i++)
- {
- if (Char.IsLetter(lineToLower[i]))
- {
- if (currentChar <= lineToLower[i])
- {
- sb.Append(line[i]);
- currentChar = lineToLower[i];
- }
- else
- {
- sb.Append(" ");
- sb.Append(line[i]);
- currentChar = lineToLower[i];
- }
- }
- }
- }
- string delimiter = Console.ReadLine();
- sb = sb.Replace(" ", delimiter);
- Console.WriteLine(sb);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment