Advertisement
allia

строка

Feb 18th, 2021
711
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3. using System.Text.RegularExpressions;
  4.  
  5. class MainClass
  6. {
  7.   public static void Main(string[] args)
  8.   {
  9.     string pattern = @"[A-Z]";
  10.     string to_delete = @"[^a-z0-9 \f\n\r\t\v]";
  11.     string to_delete_word = @"(\b([a-z0-9]){1,3}\b)";
  12.     string to_delete_space = @"\s{2, }";
  13.     string first_space = @"^\s";
  14.     string str;
  15.  
  16.     while((str = Console.ReadLine())!= null)
  17.     {
  18.       str = Regex.Replace(str, pattern, m => m.ToString().ToLower());
  19.       str = Regex.Replace(str, to_delete, String.Empty);
  20.       str = Regex.Replace(str, to_delete_word, String.Empty);
  21.       str = Regex.Replace(str, to_delete_space, @"\s");
  22.       Console.WriteLine(Regex.Replace(str, first_space, String.Empty));
  23.     }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement