ptr
to 0 and a count num
to 0.next()
, if num
is 0, parse the next character and its count from the compressed string. Otherwise, decrement num
and return the current character.hasNext()
, return true
if num
is greater than 0 or ptr
is not at the end of the string; otherwise, return false
.