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;
- using System.Threading.Tasks;
- namespace PlaceHolders
- {
- class Program
- {
- public static List<string> cells = new List<string>();
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- while(input != "end")
- {
- string[] inputToken = input.Split(new string[] { " -> " }, StringSplitOptions.RemoveEmptyEntries);
- List<char> sentenceBuild = inputToken[0].ToList();
- string[] WordList = inputToken[1].Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries);
- for (int i = 0; i < sentenceBuild.Count; i++)
- {
- if (sentenceBuild[i] == '{' && sentenceBuild[i + 2] == '}')
- {
- int index = int.Parse(sentenceBuild[i + 1].ToString());
- index = Math.Abs(index);
- sentenceBuild.RemoveRange(i, 3);
- List<char> entry = WordList[index].ToList();
- entry.Reverse();
- foreach (var letter in entry)
- {
- sentenceBuild.Insert(i, letter);
- }
- }
- }
- foreach(var letter in sentenceBuild)
- {
- Console.Write(letter);
- }
- Console.WriteLine();
- input = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment