solve small input and fix mistake
solve large garbled input