Dsa
Trie
Hard
Count Distinct Substrings
Write a program to count the number of distinct substrings of a given string using a trie. Input format: The first line contains the string (1 ≤ length of string ≤ 1000). Output format: Print the number of distinct substrings. Example: Input: ababa
Output: 9
Key concepts
triesubstringstring processing
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now