73. Character Frequency
Core1000 ms256 MBSolved by 0%
Read a line of text, then a single character on the next line.
Print how many times that character appears in the line. The comparison is
case-sensitive: A and a are different characters.
Constraints - The line has between 1 and 100000 characters. - Printable ASCII only.
Input
The first line contains the text. The second line contains the single character to count.
Output
Print one integer — how many times the character appears in the line.
Inputhello world
l
Output3
Notecounts a letter appearing three times
InputHello
h
Output0
Noteis case-sensitive, so lowercase h does not match uppercase H
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution