Java substring comparisons hackerrank solution. OK maybe going on 150.