Skip to content

Instantly share code, notes, and snippets.

@steve-taylor
Created September 27, 2012 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steve-taylor/3794542 to your computer and use it in GitHub Desktop.
Save steve-taylor/3794542 to your computer and use it in GitHub Desktop.
Semi
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