Practice · 5 of 5
Distinct Substrings
CHALLENGE
Difficulty: intermediate+25 XP
**Description:** Count the distinct non-empty substrings of s. Constraints are small
on purpose: 1 <= |s| <= 120.
**Input:** One line: s (1 <= |s| <= 120, lowercase letters).
**Output:** One integer — the number of distinct non-empty substrings.
**Example:** aba -> 5 (a, b, ab, ba, aba).
Press Submit to check your solution.
Back to lesson: Practice: String Problem Set