Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ConsoleApplication1
- {
- using System;
- using System.Collections.Generic;
- public class Startup
- {
- public static void Main()
- {
- var input = Console.ReadLine();
- var text = string.Empty;
- var result = new List<string>();
- while (!input.Equals("---NMS SEND---"))
- {
- text += input;
- input = Console.ReadLine();
- }
- var word = string.Empty;
- var previousChar = '@';
- foreach (char currentChar in text)
- {
- if (char.ToLower(currentChar) >= char.ToLower(previousChar))
- {
- word += currentChar.ToString();
- previousChar = currentChar;
- }
- else
- {
- result.Add(word);
- word = currentChar.ToString();
- previousChar = currentChar;
- }
- }
- result.Add(word);
- var delimiter = Console.ReadLine();
- Console.WriteLine(string.Join(delimiter, result));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement