Practice · 1 of 3
Distinct by Length
CHALLENGE
Difficulty: advanced+25 XP
**Problem.** Line 1: string s. Line 2: q. Each next line: L. Print, per query, the number of distinct substrings of s with length exactly L. **Constraints:** 1 ≤ |s| ≤ 1000; 1 ≤ q ≤ 100; 1 ≤ L ≤ |s|. Rolling hash + sort/unique per length.
Press Submit to check your solution.
Back to lesson: Practice: String Trio