Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace АучDeleter
- {
- class Program
- {
- public static string s { get; set; }
- public static string A = "Ауч";
- public static int a;
- public static int y;
- public static int ch;
- static void Main(string[] args)
- {
- Console.WriteLine("Введите сообщение");
- s = Console.ReadLine();
- Console.WriteLine(Deleter(s));
- }
- public static string Deleter(string s)
- {
- if (s.Contains(A) || s.Contains(A.ToLower()) || s.Contains(A.ToUpper()))
- {
- s = null;
- return s;
- }
- if (s.Contains("А") || s.Contains("а") || s.Contains("У") || s.Contains("у") || s.Contains("Ч") || s.Contains("ч"))
- {
- char[] chars = s.ToCharArray();
- for (int i = 0; i < chars.Length; i++)
- {
- if (chars[i] == 'А' || chars[i] == 'а' ) a = i;
- if (chars[i] == 'У' || chars[i] == 'у') y = i;
- if (chars[i] == 'Ч' || chars[i] == 'ч') ch = i;
- if (Math.Abs(a - y) >= 1 || Math.Abs(a - ch) >= 1 || Math.Abs(y - ch) >= 1)
- {
- s.Insert(a, "");
- s.Insert(y, "");
- s.Insert(ch, "");
- }
- }
- }
- return s;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement