#23
just to do an i-j difference
positions[i+1] remembers the character appearing times after s[i];
positions[0] is for start point