Advertisement
Cawa245

Untitled

Jan 18th, 2021
766
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6.  
  7. namespace ConsoleApp1
  8. {
  9.     public class Program
  10.     {
  11.         private static void Main()
  12.         {
  13.             Console.WriteLine("Введите строку");
  14.             string line = Console.ReadLine();
  15.             var str =  new StringBuilder();
  16.             foreach (var word in line.Split(" "))
  17.             {
  18.                 //Чистим слово от всяких точек, кавычек и прочего
  19.                 var tmp = new string(word.Where(char.IsLetter).ToArray());
  20.                 //Если слово 4 буквенное, не добавляем
  21.                 if (tmp.Length != 4) str.Append(word + " ");
  22.             }
  23.             Console.WriteLine(str.ToString());
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement