Skip to content

Instantly share code, notes, and snippets.

@briandiaz
Created June 2, 2014 20:11
Show Gist options
  • Save briandiaz/5933973870e44024a4d4 to your computer and use it in GitHub Desktop.
Save briandiaz/5933973870e44024a4d4 to your computer and use it in GitHub Desktop.
Find a Writer problem at CodeEval.com (https://www.codeeval.com/open_challenges/97/)
/*
Author: Brian Díaz
*/
using System;
using System.Text;
using System.IO;
using System.Collections.Generic;
class Program
{
public static void Main(string[] args)
{
string Line = "";
string[] Encoded;
string NameEncoded;
string[] Keys;
String WriterName;
System.IO.StreamReader file = new System.IO.StreamReader(args[0]);
while ((Line = file.ReadLine()) != null)
{
Encoded = Line.Split('|');
NameEncoded = Encoded[0];
Keys = Encoded[1].Split(' ');
WriterName = String.Empty;
foreach (string Position in Keys)
if (!Position.Equals(""))
WriterName += NameEncoded[Convert.ToInt32(Position) - 1];
Console.WriteLine(WriterName);
WriterName = String.Empty;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment