Created
September 27, 2012 15:14
-
-
Save steve-taylor/3794542 to your computer and use it in GitHub Desktop.
Semi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Challenge { | |
public static void main(String[] args) throws Exception { | |
int r=0; | |
for(String t : ("+"+Input.read().replaceAll("plus\\s+","+").replaceAll("minus\\s+","-")).split(" ")) | |
r+=(t.charAt(0)=='+'?1:-1)*(java.util.Arrays.asList("on","tw","th","fo","fi","si","se","ei","ni").indexOf(t.substring(1,2))+1); | |
Output.write(""+r); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment