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;
- using System.Runtime.InteropServices;
- namespace _02._Boss_Rush
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- string[] command = Console.ReadLine().Split();
- while (command[0] != "Done")
- {
- if (command[0] == "TakeOdd")
- {
- char[] chars = input.ToCharArray();
- string word = "";
- for (int i = 0; i < chars.Length; i++)
- {
- if (i % 2 == 1)
- {
- word += chars[i];
- }
- }
- input = word;
- }
- if (command[0] == "Cut")
- {
- int index = int.Parse(command[1]);
- int lenght = int.Parse(command[2]);
- input = input.Remove(index, lenght);
- }
- if (command[0] == "Substitute")
- {
- //• Substitute {substring} {substitute}
- if (input.Contains(command[1]))
- {
- input = input.Replace(command[1], command[2]);
- }
- else
- {
- Console.WriteLine("Nothing to replace!");
- command = Console.ReadLine().Split();
- continue;
- }
- }
- Console.WriteLine(input);
- command = Console.ReadLine().Split();
- }
- Console.WriteLine($"Your password is: {input}");
- }
- }
- }
Advertisement