Advertisement
kirya_shkolnik

C# - Убрать слова менее пяти буков

Jan 21st, 2021
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3. using System.Collections.Generic;
  4. class Practic {
  5.   public static string var15(string str) {
  6.     string[] words = str.Split(' ');
  7.     for(int i = 0; i<words.Length; ++i){
  8.         if(words[i].Length < 5) words[i] = "";
  9.     }
  10.     str = String.Join(" ", words);
  11.     return str;
  12.   }
  13.   public static void Main() {
  14.     List < string > str = new List < string > ();
  15.     Console.WriteLine("Введите строки");
  16.     string input = "";
  17.     while ((input = Console.ReadLine()) != "")
  18.       str.Add(input);
  19.     foreach(var s in str) {
  20.       Console.WriteLine(var15(s));
  21.  
  22.     }
  23.   }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement