#C9215. Count Repeated Letters

    ID: 53284 Type: Default 1000ms 256MiB

Count Repeated Letters

Count Repeated Letters

Given a list of words, your task is to count how many words contain at least one pair of consecutive identical letters.

The solution should read input from standard input (stdin) and write the output to standard output (stdout).

Note: A word is considered to have repeated letters if there exists at least one position i such that \( s_i = s_{i+1} \).

Example:

  • Input: 4
    hello world book tree
    → Output: 3
  • Input: 3
    cat dog fish
    → Output: 0

inputFormat

The first line of input contains an integer \( n \) indicating the number of words. The second line contains \( n \) space-separated strings representing the words.

outputFormat

Output a single integer representing the number of words that contain at least one pair of consecutive identical letters.

## sample
4
hello world book tree
3