Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace _01G2August
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- while (true)
- {
- string commands = Console.ReadLine();
- string[] cmd = commands.Split(" ");
- string cmdType = cmd[0];
- if(cmdType == "Done")
- {
- break;
- }
- if(cmdType == "Change")
- {
- string ch = cmd[1];
- string replacement = cmd[2];
- input = input.Replace(ch,replacement);
- Console.WriteLine(input);
- }
- if(cmdType == "Includes")
- {
- bool valid = input.Contains(cmd[1]);
- Console.WriteLine(valid);
- }
- if(cmdType == "End")
- {
- bool end = input.EndsWith(cmd[1]);
- Console.WriteLine(end);
- }
- if(cmdType == "Uppercase")
- {
- input = input.ToUpper();
- Console.WriteLine(input);
- }
- if(cmdType == "FindIndex")
- {
- int indexOf = input.IndexOf(cmd[1]);
- Console.WriteLine(indexOf);
- }
- if(cmdType == "Cut")
- {
- int startIndex = int.Parse(cmd[1]);
- int count = int.Parse(cmd[2]);
- string removedString = input.Substring(startIndex,count);
- Console.WriteLine(removedString);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement