got output correct on the first sample... error breaking it on sample input 2 though (currently input.txt)