Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Удалить из сообщения все повторяющиеся слова.
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace mainSolution
- {
- static class Program
- {
- static void Main(string[] args)
- {
- char[] sign = { ' ', '.', ',', ';', ':', '?', '!', '-' };
- string[] a = Console.ReadLine().Split(sign, StringSplitOptions.RemoveEmptyEntries);
- List<string> ans = new List<string>(a.Length);
- for (int i = 0; i < a.Length; ++i)
- {
- bool check = true;
- for (int j = 0; j < a.Length; ++j)
- {
- if (i == j)
- continue;
- if (a[i].ToLower() == a[j].ToLower())
- {
- check = false;
- break;
- }
- }
- if (check)
- ans.Add(a[i]);
- }
- foreach (var v in ans)
- Console.Write(v + " ");
- }
- }
- }
Add Comment
Please, Sign In to add comment