Question bank › Sliding Window
Dsa Sliding Window Medium

Count Repeated Words in Sentence

You are given a sentence `s` consisting of words separated by spaces. Your task is to count how many words appear more than once in the sentence. Implement a function that reads from standard input and prints the count of repeated words to standard output. ### Input Format: - A single line containing the sentence `s` (length of s <= 10^5). ### Output Format: - An integer representing the count of words that appear more than once in the sentence. ### Example: Input: hello world hello Output: 1 In the example, the word 'hello' appears more than once, so the output is 1.

Key concepts

sliding_windowstringshashmap

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