Question bank › Strings
Dsa Strings Easy

Anagram Count in Substrings

Given a string, find the count of all distinct anagrams of its substrings. Input: The input is a single line containing a string s (1 ≤ |s| ≤ 100), consisting of lowercase letters only. Output: Print the total number of distinct anagrams of all substrings of the string. Example: Input: abca Output: 7 (The anagrams are: a, ab, abc, ac, b, ba, c)

Key concepts

stringsanagramssubstrings

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.