Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections.Immutable;
- using System.ComponentModel.Design;
- using System.Data;
- using System.Diagnostics;
- using System.Globalization;
- using System.Linq;
- using System.Net.Http.Headers;
- using System.Runtime.InteropServices.ComTypes;
- using System.Security;
- using System.Text;
- using System.Transactions;
- using System.Xml.Linq;
- using System.Text.RegularExpressions;
- using System.Threading;
- namespace Homework
- {
- class Program
- {
- static void Main()
- {
- string line = Console.ReadLine();
- string changedInput = line;
- string[] command = Console.ReadLine().Split();
- StringBuilder sb = new StringBuilder();
- while (command[0] != "Done")
- {
- if (command[0] == "Change")
- {
- string character = command[1];
- string replacement = command[2];
- line = line.Replace(character, replacement);
- Console.WriteLine(line);
- }
- else if (command[0] == "Includes")
- {
- string substring = command[1];
- if (line.Contains(substring))
- {
- Console.WriteLine("True");
- }
- else
- {
- Console.WriteLine("False");
- }
- }
- else if (command[0] == "End")
- {
- if (line.EndsWith(command[1]))
- {
- Console.WriteLine("True");
- }
- else
- {
- Console.WriteLine("False");
- }
- }
- else if (command[0] == "Uppercase")
- {
- line.ToString();
- line = line.ToUpper();
- Console.WriteLine(line);
- }
- else if (command[0] == "FindIndex")
- {
- string character = command[1];
- int count = -1;
- foreach (var currChar in line)
- {
- count++;
- character.ToCharArray();
- if (currChar == character[0])
- {
- Console.WriteLine(count);
- break;
- }
- }
- }
- else if (command[0] == "Cut")
- {
- int startIndex = int.Parse(command[1]);
- int count = int.Parse(command[2]);
- changedInput = line.Substring(startIndex, count);
- Console.WriteLine(changedInput);
- break;
- }
- command = Console.ReadLine().Split();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment