/* The Great Win32 Language Shootout http://dada.perl.it/shootout/ contributed by Isaac Gouy (Nice novice) To compile: nicec --sourcepath=.. -d=. -a spellcheck.jar spellcheck To run: java -jar spellcheck.jar < input.txt > out.txt */ import java.io.*; void main(String[] args){ HashMapdictionary = new HashMap(); try { BufferedReader f = new BufferedReader(new FileReader("Usr.Dict.Words")); f.foreach(String word => { dictionary.put(word, 1); }); f.close(); } catch (IOException e) { System.err.println(e); return; } try { BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); r.foreach(String word => { if (!dictionary.containsKey(word)) println(word); }); } catch (IOException e) { System.err.println(e); } } void foreach(BufferedReader r, String -> void expr) { ?String s; while ((s = r.readLine()) != null) expr(s); }