a version which works on input data, but is not accepted by judge