Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- namespace _01._Warrior_s_Quest
- {
- class Program
- {
- static void Main(string[] args)
- {
- string skill = Console.ReadLine();
- string input = Console.ReadLine();
- while (input != "For Azeroth")
- {
- string[] tokens = input.Split(" ");
- string command = tokens[0];
- if (command == "GladiatorStance")
- {
- skill = skill.ToUpper();
- Console.WriteLine(skill);
- }
- else if (command == "DefensiveStance")
- {
- skill = skill.ToLower();
- Console.WriteLine(skill);
- }
- else if (command == "Dispel")
- {
- var indexToReplace = int.Parse(tokens[1]);
- char charToReplace = char.Parse(tokens[2]);
- if (indexToReplace < skill.Length && indexToReplace >= 0)
- {
- char[] temp = skill.ToCharArray();
- temp[indexToReplace] = charToReplace;
- skill = new string(temp);
- Console.WriteLine("Success!");
- }
- else
- {
- Console.WriteLine("Dispel too weak.");
- }
- }
- else if (command == "Target")
- {
- var action = tokens[1];
- if (action == "Change")
- {
- var substring = tokens[2];
- var newString = tokens[3];
- if (skill.Contains(substring))
- {
- skill = skill.Replace(substring, newString);
- Console.WriteLine(skill);
- }
- }
- else if (action == "Remove")
- {
- var substring = tokens[2];
- if (skill.Contains(substring))
- {
- var index = skill.IndexOf(substring);
- skill = skill.Remove(index, substring.Length);
- Console.WriteLine(skill);
- }
- else
- {
- Console.WriteLine("Command doesn't exist!");
- }
- }
- }
- else
- {
- Console.WriteLine("Command doesn't exist!");
- }
- input = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement