Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _01._Warrior_s_Quest___13.Dec._2019
- {
- class Program
- {
- static void Main(string[] args)
- {
- var skill = Console.ReadLine();
- var command = Console.ReadLine();
- while (command != "For Azeroth")
- {
- var actions = command.Split();
- switch (actions[0])
- {
- case "GladiatorStance":
- skill = skill.ToUpper();
- Console.WriteLine(skill);
- break;
- case "DefensiveStance":
- skill = skill.ToLower();
- Console.WriteLine(skill);
- break;
- case "Dispel":
- var index = int.Parse(actions[1]);
- var letter = actions[2];
- if (index > -1 && index < skill.Length)
- {
- skill = skill.Remove(index, 1);
- skill = skill.Insert(index, letter);
- Console.WriteLine("Success!");
- break;
- }
- Console.WriteLine("Dispel too weak."); break;
- case "Target":
- if (actions[1] == "Change")
- {
- var stringToRemove = actions[2];
- var secondString = actions[3];
- skill = skill.Replace(stringToRemove, secondString);
- Console.WriteLine(skill);
- }
- else if (actions[1] == "Remove")
- {
- var stringForRemove = actions[2];
- var indexForRemove = skill.IndexOf(stringForRemove);
- if (!skill.Contains(stringForRemove))
- {
- Console.WriteLine("Command doesn't exist!");break;
- }
- skill = skill.Remove(indexForRemove, stringForRemove.Length);
- Console.WriteLine(skill);
- }
- break;
- default: Console.WriteLine("Command doesn't exist!"); break;
- }
- command = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement