Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace problem03
- {
- class Program
- {
- static void Main(string[] args)
- {
- string text = Console.ReadLine();
- string comand = Console.ReadLine();
- while (comand != "End")
- {
- string[] infoComand = comand.Split();
- if (infoComand[0] == "Translate")
- {
- char symbol = char.Parse(infoComand[1]);
- char replaceChar = char.Parse(infoComand[2]);
- text = text.Replace(symbol, replaceChar);
- Console.WriteLine(text);
- }
- else if (infoComand[0] == "Includes")
- {
- string includeString = infoComand[1];
- bool include = text.Contains(includeString);
- Console.WriteLine(include);
- }
- else if (infoComand[0] == "Start")
- {
- string startString = infoComand[1];
- bool isStart = true;
- for (int i = 0; i < startString.Length; i++)
- {
- if(startString[i]!=text[i])
- {
- isStart = false;
- }
- }
- Console.WriteLine(isStart);
- }
- else if (infoComand[0] == "Lowercase")
- {
- text = text.ToLower();
- Console.WriteLine(text);
- }
- else if (infoComand[0] == "FindIndex")
- {
- char lastIndedx = char.Parse(infoComand[1]);
- int index = text.LastIndexOf(lastIndedx);
- Console.WriteLine(index);
- }
- else if (infoComand[0] == "Remove")
- {
- int startIndex = int.Parse(infoComand[1]);
- int count = int.Parse(infoComand[2]);
- text = text.Remove(startIndex, count);
- Console.WriteLine(text);
- }
- comand = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment