Loading...
No output yet. Run your code to see results.
Count Characters
#033
easy
string
algorithm
easy
Description
Write a function that counts how many times a specific character appears in a string.
Example:
-
Input:
s = "hello",char = "l" -
Output:
2(because 'l' appears twice) -
Input:
s = "programming",char = "m" -
Output:
2
Instructions
- Return the count of how many times the character appears
- The comparison should be case-sensitive
- Return 0 if the character is not found