String Compression

out of bound condition ja rahi h
when checking s[i] == s[i+1]

check out this code