Skip to main content

Accenture

Accenture OA-1 2024

Problem Description

You are given a string S of length N. Your friend wants to know the number of times his favorite letter C occurs in the string. Your task is to help your friend find and return an integer value representing the number of times a character occurs in a particular string.

Input Format:

·       The first line contains a string S with lowercase characters.

·       The second line an integer N, the length of the string.

·       The third line contains a character C.

Output Format:

Return an integer representing the number of times a character occurs in a particular string.

Constraints

  • All the characters in the strings are in lowercase.

Example

Sample Input:

helloworld
10
l

Sample Output:

3

Explanation:

In the string "helloworld", the character 'l' appears 3 times. Therefore, the output is 3.