Sobes.tech
Junior — Senior

Counting substrings without repeating characters

livecode

Task condition

Given a string consisting only of lowercase Latin letters. It is required to determine the number of its substrings in which each character appears no more than once.

Examples: aba → a, b, ab, ba, a → 5 abc → a, b, c, ab, bc, abc → 6