Count the last word P86396


Statement
 

pdf   zip

html

Write a program that reads a sequence of words and prints how many times the last word appears.

Input

Input starts with a natural number n≥1 that indicates how many words are coming. Then, there are n words.

Output

Your program must print, in a line, how many times appears the last word of the sequence.

Observation

Use recursion (not tables).

Public test cases
  • Input

    8 lamb cat dog cat lamb lamb cat dog
    

    Output

    2
    
  • Input

    10 lemon apple pear lemon pear melon orange peach apple apple
    

    Output

    3
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++