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 ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- //. , : ; ( ) [ ] " ' \ / ! ? (space).
- var arrayOfWords = Console.ReadLine()
- .ToLower()
- .Split(new char[] { '.', ',', ':', ';', '(', ')', '[', ']', '"', '\'', '\\', '/', '!', '?', ' ' },StringSplitOptions.RemoveEmptyEntries)
- .ToArray();
- var smallWords = new List<string>();
- foreach (var word in arrayOfWords)
- {
- if (word.Length < 5)
- {
- smallWords.Add(word);
- }
- }
- var result = smallWords
- .OrderBy(w => w)
- .Distinct();
- Console.WriteLine(string.Join(", ", result));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment