DCP-30: Count It Back to All Problems

Beginner Beginners Problems > Ad-hoc

In this problem you have to count the letters in a string and print the count. For this problem always consider the string will only contain lowercase English letters that is ‘a’ to ‘z’ only. So there is no space or other invalid character in input. You have to count the frequency of each letter and print the frequency along with the letter. If any letter has zero frequency (zero occurrences) then you should skip printing it. Input: ------ First line of the input will consist of an integer which represent the test case **T (0 < T<= 30)**. Each test case contains a string of only lower case English letters. You can assume the length of the string will be no greater than 100 characters. Output: ------- For each test case first print the test case number as “**Case X:**” where **X** is the test case number. Then print the frequencies of each letter. Each letter should be printed in a line with the format, “**A B**”. Where **A** is the letter and **B** is the frequency. Any frequency of 0 should be avoided from printing. You should print the list in ascending order of the letter that is you should print frequency of ‘a’ first then ‘b’, then ‘c’ up to ‘z’. Sample Input ------------ 3 blabla dragon thisishasan Sample Output ------------- Case 1: a 2 b 2 l 2 Case 2: a 1 d 1 g 1 n 1 o 1 r 1 Case 3: a 2 h 2 i 2 n 1 s 3 t 1

Problem Setter:

MD. Jalal Uddin

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C/C++ 1.00
Java 2.00
C# 2.00
PHP 2.00

Problem Stats




# User Language Timing
01 The_Viper Cpp 0.00s
02 mahrahat Cpp 0.00s
03 Sabyasachi Cpp 0.00s
04 Najat Cpp 0.00s
05 joy25896 Cpp 0.00s
06 ronok_cse Cpp 0.00s
07 Aman_khan Cpp 0.00s
08 emrul Cpp 0.00s
09 Ashish972 Cpp 0.00s
10 ishrafislam2727 Cpp 0.00s
11 maxhasan Cpp 0.00s
12 gazi93 Cpp 0.00s
13 Kira Cpp 0.00s
14 terminator_c Cpp 0.00s
15 golapraj Cpp 0.00s
16 Uap_Amit Cpp 0.00s
17 jayed_al_hasan Cpp 0.01s
18 Indro_BU Cpp 0.01s
19 Rezwan10 Cpp 0.01s
20 MarufAhmed Cpp 0.01s
21 Ansarul_14 Cpp 0.01s
22 subhashis_cse Cpp 0.01s
23 iamramzan Cpp 0.01s
24 Atick Cpp 0.07s
25 rezaul_karim Cpp 0.07s
26 Sheikh_Fahad Cpp 0.07s
27 anis Cpp 0.07s
28 SkSaber Cpp 0.07s
29 Dinar Cpp 0.08s
30 abdurrahmanriyad Cpp 0.08s
31 marineCoder Cpp 0.08s
32 Faridur Cpp 0.09s
33 sohag_AUST Cpp 0.09s
34 Pankaj Cpp 0.20s
35 ih_hira Cpp 0.22s
36 monsurmp Cpp 0.23s
37 cse_nazmul Cpp 0.25s
38 anwar3606 Cpp 0.26s
39 myhobby Cpp 0.39s
40 haasib Cpp 0.39s
41 mahbub07 Cpp 0.39s
42 tariqiitju Cpp 0.39s
43 ArifKhanShubro Cpp 0.40s
44 TrustIsEveryThing Cpp 0.41s
45 dip_BRUR Cpp 0.42s
46 codehead Cpp 0.44s
47 sajid Cpp 0.48s
48 AshikeRuet12 Cpp 0.48s
49 njrafi Cpp 0.48s
50 anowar1112 Cpp 0.48s

Your feedback is our precious!

Or call +88 02 9853138 for support