• Thinking C + +

Question related to mission Extra dashes

 
index, str = 0, ""
count = len(line)
while index < count:
    str += line[index]

    if line[index] == '-':
        while (index < count) and (line[index] == '-'):
            index += 1
    else:
        index += 1