All problems

Count Occurrences of a Character

easyPythonStrings

A lab tool inspects short DNA-style sequences written as plain letters. A technician types the sequence, then types the single letter they are interested in, and the tool reports how often that letter shows up. The letter is chosen at run time, so it cannot be baked into the program.

Task: Read the sequence and the letter, and print how many times the letter appears in the sequence.

Input

Two lines. Line 1 holds a string s of 1 to 100 lowercase letters, with no spaces. Line 2 holds exactly one lowercase letter, ch.

Output

One line holding a single integer: how many times ch appears in s. Print 0 if it never appears.

Example:

Input:
mississippi
s

Output:
4

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…