This page is still under construction.

Parts of this page are still being built. What you see may change.

MBTI

Time limit1sMemory limit512 MB

Summary
Given Jinho's MBTI type and N friends' types, count how many friends share Jinho's type.
Level

Easy1 of 10

Topics
Implementation, String
Solved
No attempts yet

Problem

Jinho has been interested in MBTI, a personality test that has become popular lately. MBTI sorts people along four scales, and a person is assigned one of 1616 types.

  • Introversion (I) / Extraversion (E)
  • Intuition (N) / Sensing (S)
  • Feeling (F) / Thinking (T)
  • Perceiving (P) / Judging (J)

The full list of types is INFP, ENFP, ISFP, ESFP, INTP, ENTP, ISTP, ESTP, INFJ, ENFJ, ISFJ, ESFJ, INTJ, ENTJ, ISTJ, ESTJ.

Jinho asked NN friends for their MBTI types. How many of them have the same type as Jinho?

Input

The first line contains Jinho's MBTI type.

The second line contains the number of friends NN (1≤N≤1001\le N \le 100).

The next NN lines contain the MBTI types of the friends.

Output

Print the number of friends whose MBTI type is the same as Jinho's.

Examples2

  1. Example 1

    Input
    ESTJ
    5
    ISTP
    ESTJ
    INTP
    ESTJ
    ENTJ
    
    Expected output
    2
    
  2. Example 2

    Input
    INTP
    6
    INTP
    INTP
    ESFP
    ISFP
    INFP
    INTP
    
    Expected output
    3