Rahul the "Coder"

5

3 votes
Easy
Problem

It was Lab internals for the 2nd year students and Rahul who is really a very good coder was excited to take part in it. It was a batch of 30 and eveyone was randomly assigned a question for the internals. So a lottery was conducted and Rahul recieved question number one .

Rahul was handed the question paper and below is what the question said:

Q: Suppose you are given a paragraph, your task is to tell the frequency of each letter on a new line (See sample and read the Explanation). For example if the paragraph given is this:

[ "The quick brown fox jumps over the lazy dog" is an English-language pangram—a phrase that contains all of the letters of the alphabet. It is commonly used for touch-typing practice. It is also used to test typewriters and computer keyboards, show fonts, and other applications involving all of the letters in the English alphabet. Owing to its brevity and coherence, it has become widely known. ]

Then your code should output this:

A : 25
B : 6
C : 11
D : 8
E : 33
F : 6
G : 9
H : 17
I : 22
J : 1
K : 3
L : 17
M : 6
N : 22
O : 26
P : 11
Q : 1
R : 15
S : 21
T : 33
U : 7
V : 4
W : 6
X : 1
Y : 7
Z : 1

Well according to Rahul it was a cakewalk and he coded out the correct solution within Ten minutes.So if you were present in place of Rahul could you beat his time ?

Input Format:

A paragraph will be given as input.

Output Format:

If the letter is present in the paragraph display the letter in Captal followed by a " : " without quotes followed by the frequency of the letter on a new line. Such that the letters displayed must be in lexicographical order.

Constraints:

Maximum of 1000 words will be present in the paragraph.

Time Limit: 1.5
Memory Limit: 256
Source Limit:
Explanation

In the given paragraph the above letters are present and they are displayed in lexicographical order in Capital along with their frequency on a new line.

Editor Image

?