Skip to content

Instantly share code, notes, and snippets.

@juanplopes
Created March 9, 2012 18:26
Show Gist options
  • Select an option

  • Save juanplopes/2007893 to your computer and use it in GitHub Desktop.

Select an option

Save juanplopes/2007893 to your computer and use it in GitHub Desktop.
using System;
using System.Linq;
using System.IO;
class MainClass
{
public static void Main (string[] args)
{
var items = File.ReadLines("textfile.txt")
.Select(x=>x.Split(' '))
.GroupBy(x=>x[1], x=>long.Parse(x[0]))
.Select(x=>new { x.Key, Value=x.Skip(1).Zip(x, (a,b)=> a-b) });
foreach (var item in items)
Console.WriteLine("{0}:{1}", item.Key, String.Join(",", item.Value.ToArray()));
}
}
@peas

peas commented Mar 9, 2012

Copy link
Copy Markdown

boa!! posta la no forum da pragprog!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment