#C14077. Total Frequency by Initial Letter
Total Frequency by Initial Letter
Total Frequency by Initial Letter
You are given a dictionary of words with their frequencies and a target string. Your task is to calculate the total frequency of all words that start with the same initial letter as the target string. The comparison is case-insensitive.
If the target string is empty or no word matches, the output should be 0.
Input is read from stdin and the result should be printed to stdout.
inputFormat
The first line contains an integer n representing the number of word-frequency pairs in the dictionary. The next n lines each contain a word and an integer (its frequency), separated by a space. The last line contains the target string.
For example:
3
apple 10
banana 5
grape 7
a
outputFormat
Output a single integer which is the total frequency of all words that start with the same letter (case-insensitive) as the target string.## sample
3
apple 10
banana 5
grape 7
x
0