public static void Main()
string input = "00:01 - 00:03 [Top, Red] Hello \n00:01 - 00:03 [Bottom, Red] World \n00:02 - 00:06 [Right, Green] Yes \n00:04 - 00:07 [Left, Blue] No \n00:07 - 00:15 Bill is a very motivated young man";
string[] strings = input.Split('\n');
char[] separators = new char[] {':', '-', '[',']'};
foreach (string str in strings)
string[] splitted = str.Split(separators);
int lastTime = Int32.Parse(splitted[4].Trim()) + Int32.Parse(splitted[3].Trim())*60;
string[] actions = new string[maxTime];
for (int i = 1; i<= maxTime; i++)
foreach (string str in strings)
string[] splitted = str.Split(separators);
int startTime = Int32.Parse(splitted[2].Trim()) + Int32.Parse(splitted[1].Trim())*60;
int endTime = Int32.Parse(splitted[4].Trim()) + Int32.Parse(splitted[3].Trim())*60;
if (actions[startTime].Length != 0)
actions[startTime] += ';';
actions[startTime] += ("add:{0}",splitted[splitted.Length - 1]);
actions[startTime] += @":splitted[5]";
else actions[startTime] += ":Bottom, White";
if (actions[endTime].Length != 0)
actions[startTime] += ';';
actions[startTime] += ("remove:{0}",splitted[splitted.Length - 1].Length);
string[] placeAndColor = splitted[5].Split(',');
actions[startTime] +='+' + placeAndColor[0].Trim();
else actions[startTime] += ":Bottom";
MakeAFrame(height, width);
for (int i = 1; i <= maxTime; i++)
if (String.Equals(actions[i], ""))
else if (actions[i].IndexOf(';') == -1)
DoAction (actions[i], height, width);
string[] allActions = actions[i].Split(';');
foreach (string action in allActions)
DoAction(action, height, width);
public static void DoAction (string action, int height, int width)
string[] splittedA = action.Split(':');
string[] placeAndColor = splittedA[2].Split(',');
if (String.Equals(splittedA[0], "add"))
ColorTextIn(placeAndColor[1].Trim());
MoveCursorTo(placeAndColor[0].Trim(), splittedA[1].Length,height, width);
Console.Write(splittedA[1]);
int length = Int32.Parse(splittedA[1]);
MoveCursorTo(placeAndColor[0].Trim(), length ,height, width);
for (int i = 0; i < length; i++)
public static void MoveCursorTo (string place, int length, int height, int width)
Console.SetCursorPosition((width - length) / 2, 1);
Console.SetCursorPosition((width - length) / 2, height - 2);
Console.SetCursorPosition(width - 1 - length, height/2);
Console.SetCursorPosition(1, height/2);
public static void ColorTextIn (string color)
Console.ForegroundColor = ConsoleColor.Red;
Console.ForegroundColor = ConsoleColor.Blue;
Console.ForegroundColor = ConsoleColor.Green;
Console.ForegroundColor = ConsoleColor.White;
public static void MakeAFrame (int height, int width)
for (int x = 0; x < width; x++)
for (int y = 0; y < height; y++)
else if ((y == height - 1)&&(x==0))
else if ((y == 0)&&(x == width - 1))
else if ((y == height - 1)&&(x == width - 1))
else if ((y == 0) || (y == height - 1))