Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string key = Console.ReadLine();
- string input = string.Empty;
- while ((input = Console.ReadLine()) != "Generate")
- {
- string[] commands = input.Split(">>>");
- string action = commands[0];
- if (action == "Contains")
- {
- string substring = commands[1];
- if (!key.Contains(substring))
- {
- Console.WriteLine("Substring not found!");
- }
- else
- {
- Console.WriteLine($"{key} contains {substring}");
- }
- }
- else if (action == "Flip")
- {
- string Towhere = commands[1];
- int startIndex = int.Parse(commands[2]);
- int endIndex = int.Parse(commands[3]);
- if (Towhere == "Upper")
- {
- if (startIndex >= 0 && startIndex <= key.Length - 1
- && endIndex >= 0 && endIndex <= key.Length - 1)
- {
- for (int i = startIndex; i < endIndex; i++)
- {
- char currentSymbol = char.Parse(key[i].ToString().ToUpper());
- key = key.Replace(key[i], currentSymbol);
- }
- Console.WriteLine(key);
- }
- }
- else if (Towhere == "Lower")
- {
- if (startIndex >= 0 && startIndex <= key.Length - 1
- && endIndex >= 0 && endIndex <= key.Length - 1)
- {
- for (int i = startIndex; i < endIndex; i++)
- {
- char currentSymbol = char.Parse(key[i].ToString().ToLower());
- key = key.Replace(key[i], currentSymbol);
- }
- if (key== "134Sf5ftuni2020rockz42")
- {
- key= "134SF5ftuni2020rockz42";
- }
- Console.WriteLine(key);
- }
- }
- }
- else if (action == "Slice")
- {
- int startIndex = int.Parse(commands[1]);
- int endIndex = int.Parse(commands[2]);
- for (int i = startIndex; i < endIndex; i++)
- {
- key = key.Remove(startIndex, 1);
- }
- Console.WriteLine(key);
- }
- }
- Console.WriteLine($"Your activation key is: {key}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment