Skip to content

Instantly share code, notes, and snippets.

View larsga's full-sized avatar

Lars Marius Garshol larsga

View GitHub Profile
@larsga
larsga / kata.py
Created March 28, 2012 07:09
Anagram code kata
def make_key(str):
key = list(str)
key.sort()
return "".join(key)
classes = {}
for line in open("wordlist.txt"):
word = line.strip().lower()
key = make_key(word)

Keybase proof

I hereby claim:

  • I am larsga on github.
  • I am larsga (https://keybase.io/larsga) on keybase.
  • I have a public key ASD7BkvYLDinqT6Z63GwiXZy1KuRGxBNRuNBp1KMly98cQo

To claim this, I am signing this object:

import java.util.*;
import java.io.FileReader;
import java.io.BufferedReader;
// read text file (plain text, no formatting)
// output how many times each word occurs in the text
// words consist only of A-Z/a-z, nothing else
// 'hello, Hello, jean-paul' => 'hello: 2 jean: 1 paul: 1'
public class Counter {