Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.Text.RegularExpressions;
- namespace _02._Boss_Rush
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- string[] command = Console.ReadLine().Split();
- while (command[0] != "Sign")
- {
- if (command[0] == "Case")
- {
- if (command[1] == "lower")
- {
- input = input.ToLower();
- }
- else
- {
- input = input.ToUpper();
- }
- Console.WriteLine(input);
- }
- if (command[0] == "Reverse")
- {
- int start = int.Parse(command[1]);
- int end = int.Parse(command[2]);
- if ((start >= 0 && start < input.Length) && end >= 0 && end < input.Length)
- {
- string substring = input.Substring(start, end - start + 1);
- char[] reverse = substring.Reverse().ToArray();
- string output = new string(reverse);
- Console.WriteLine(output);
- }
- }
- if (command[0] == "Cut")
- {
- if (input.Contains(command[1]))
- {
- int index = input.IndexOf(command[1]);
- input = input.Remove(index, command[1].Length);
- Console.WriteLine(input);
- }
- else
- {
- Console.WriteLine($"The word {input} doesn't contain {command[1]}.");
- }
- }
- if (command[0] == "Replace")
- {
- input = input.Replace(command[1], "*");
- Console.WriteLine(input);
- }
- if (command[0] == "Check")
- {
- if (input.Contains(command[1]))
- {
- Console.WriteLine("Valid");
- }
- else
- {
- Console.WriteLine($"Your username must contain {command[1]}.");
- }
- }
- command = Console.ReadLine().Split();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement