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] != "Complete")
- {
- if (command[0] == "Make")
- {
- if (command[1] == "Upper")
- {
- input = input.ToUpper();
- }
- else
- {
- input = input.ToLower();
- }
- Console.WriteLine(input);
- }
- if (command[0] == "GetDomain")
- {
- int count = int.Parse(command[1]);
- if (count >= 0 && count < input.Length)
- {
- char[] reverse = input.TakeLast(count).ToArray();
- string output = new string(reverse);
- Console.WriteLine(output);
- }
- else
- {
- Console.WriteLine(input);
- }
- }
- if (command[0] == "GetUsername")
- {
- if (input.Contains("@"))
- {
- int index = input.IndexOf("@");
- string username = input.Substring(0, index);
- Console.WriteLine(username);
- }
- else
- {
- Console.WriteLine($"The email {input} doesn't contain the @ symbol.");
- }
- }
- if (command[0] == "Replace")
- {
- input = input.Replace(command[1], "-");
- Console.WriteLine(input);
- }
- if (command[0] == "Encrypt")
- {
- char[] email = input.ToCharArray();
- List<int> output = new List<int>();
- foreach (int item in email)
- {
- output.Add(item);
- }
- Console.WriteLine(string.Join(" ", output));
- }
- command = Console.ReadLine().Split();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement