Dsa
Recursion
Warm-up
The Echo Chamber
In a mystical canyon, every word you shout echoes back, but each echo loses its first character and repeats until either the word is empty or it has echoed N times. Given a word and a number N, print the original word followed by its echoes on a single line, separated by spaces.
Input Format: A single line containing a string S and an integer N separated by a space.
Output Format: A single line containing the sequence of strings.
Example:
Input: HELLO 3
Output: HELLO ELLO LLO
Key concepts
recursionstring manipulation
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