https://ide.codingblocks.com/s/61355
cant figure out to skip the extra counting and output for each character
Problem Title-string compression
Hi Atishay, first of all, you do need to
for i : 0 -> n
for j : i+1 -> n
instead you have to traverse the string only once. When you do this you will get the correct answer
Hint:
for i: 1 -> n -1
ch = s[i]
while ( ch == s[i] ) {
count++ ;
i++ ;
}
print ch , count ;