diff options
-rwxr-xr-x | spellchecker/run.sh | 7 | ||||
-rw-r--r-- | spellchecker/src/SpellChecker.java | 11 |
2 files changed, 13 insertions, 5 deletions
diff --git a/spellchecker/run.sh b/spellchecker/run.sh index 14c7057..956ce67 100755 --- a/spellchecker/run.sh +++ b/spellchecker/run.sh @@ -1,4 +1,7 @@ #!/bin/sh -ant -q -S compile && +classpath="${CLASSPATH:+$CLASSPATH:}" +classpath+=build/classes + +ant -q -S compile >&2 && NO_PEACH=1 \ -java -ea -cp build/classes SpellChecker +java -ea -cp "$classpath" SpellChecker diff --git a/spellchecker/src/SpellChecker.java b/spellchecker/src/SpellChecker.java index 055326e..55f8f6b 100644 --- a/spellchecker/src/SpellChecker.java +++ b/spellchecker/src/SpellChecker.java @@ -33,10 +33,15 @@ public class SpellChecker { Scanner input = new Scanner(System.in); while (input.hasNextLine()) { String s0 = input.nextLine(); - System.out.println("Input : " + s0); String result = sc.correctPhrase(s0); - System.out.println("Answer: " + result); - System.out.println(); + + if (System.getenv("ANSWER_ONLY") == null) { + System.out.println("Input : " + s0); + System.out.println("Answer: " + result); + System.out.println(); + } else { + System.out.println(s0); + } } } |