import algorithm let S = stdin.readLine var ttl, cnt_w = 0 for s in S.reversed: case s of 'w': cnt_w += 1 of 'c': ttl += cnt_w * (cnt_w - 1) div 2 else: discard echo ttl