Advertisement
SpaceWithYou

Untitled

Apr 18th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.49 KB | None | 0 0
  1. using System;
  2.  
  3. namespace АучDeleter
  4. {
  5.     class Program
  6.     {
  7.         public static string s { get; set; }
  8.         public static string A = "Ауч";
  9.         public static int a;
  10.         public static int y;
  11.         public static int ch;
  12.         static void Main(string[] args)
  13.         {
  14.             Console.WriteLine("Введите сообщение");
  15.             s = Console.ReadLine();
  16.             Console.WriteLine(Deleter(s));
  17.         }
  18.         public static string Deleter(string s)
  19.         {
  20.             if (s.Contains(A) || s.Contains(A.ToLower()) || s.Contains(A.ToUpper()))
  21.             {
  22.                 s = null;
  23.                 return s;
  24.             }
  25.             if (s.Contains("А") || s.Contains("а") || s.Contains("У") || s.Contains("у") || s.Contains("Ч") || s.Contains("ч"))
  26.             {
  27.                 char[] chars = s.ToCharArray();
  28.                 for (int i = 0; i < chars.Length; i++)
  29.                 {
  30.                     if (chars[i] == 'А' || chars[i] == 'а' ) a = i;
  31.                     if (chars[i] == 'У' || chars[i] == 'у') y = i;
  32.                     if (chars[i] == 'Ч' || chars[i] == 'ч') ch = i;
  33.                     if (Math.Abs(a - y) >= 1 || Math.Abs(a - ch) >= 1 || Math.Abs(y - ch) >= 1)
  34.                     {
  35.                         s.Insert(a, "");
  36.                         s.Insert(y, "");
  37.                         s.Insert(ch, "");
  38.                     }
  39.                 }
  40.             }
  41.             return s;
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement