Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- class Program
- {
- static void Main()
- {
- string title = Console.ReadLine();
- int lines = int.Parse(Console.ReadLine());
- string result = title;
- for (int i = 0; i < lines; i++)
- {
- string target = Console.ReadLine();
- int targetIndex = 0;
- for (int j = 0; j < result.Length; j++)
- {
- char searched = target[targetIndex];
- char found = result[j];
- if (found == searched)
- {
- string temp = result.Remove(j, 1);
- result = temp;
- targetIndex++;
- j--;
- }
- if (targetIndex == target.Length)
- {
- title = result;
- Console.WriteLine(string.Join("", title));
- break;
- }
- }
- if (targetIndex != target.Length)
- {
- result = title;
- Console.WriteLine("No such title found!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment