solved codeeval medium longest lines problem