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
Language | Time Limit (seconds) |
C | 1.00 |
C++ | 1.00 |
C++14 | 1.00 |
C# | 2.00 |
Go | 2.00 |
Java | 2.00 |
JavaScript | 2.00 |
Objective-C | 2.00 |
Perl | 2.00 |
PHP | 2.00 |
Python | 2.00 |
Python3 | 2.00 |
Ruby | 2.00 |
VB.Net | 2.00 |
Solve/Submission
# | User | Language | Timing |
---|---|---|---|
01 | Sabyasachi | Cpp14 | 0.00s |
02 | Najat | Cpp14 | 0.00s |
03 | The_Viper | Cpp14 | 0.00s |
04 | MAHRahat | Cpp14 | 0.00s |
05 | ronok_cse | Cpp14 | 0.00s |
06 | Aman_khan | Cpp14 | 0.00s |
07 | emrul | Cpp14 | 0.00s |
08 | joy25896 | Cpp14 | 0.00s |
09 | Ashish972 | Cpp14 | 0.00s |
10 | maxhasan | Cpp14 | 0.00s |
11 | gazi93 | Cpp14 | 0.00s |
12 | Kira | Cpp14 | 0.00s |
13 | terminator_c | Cpp14 | 0.00s |
14 | golapraj | Cpp14 | 0.00s |
15 | ammasum | Cpp14 | 0.00s |
16 | nazmul_bzs | Cpp14 | 0.00s |
17 | nurul_islam | Cpp14 | 0.00s |
18 | t0whid | Cpp14 | 0.00s |
19 | sadia2427 | Cpp14 | 0.00s |
20 | jim1 | Cpp14 | 0.00s |
21 | abd007 | Cpp14 | 0.00s |
22 | mahamud_BU | Cpp14 | 0.00s |
23 | Masum_ice | Cpp14 | 0.00s |
24 | SakibAlamin | Cpp14 | 0.00s |
25 | deder | Cpp14 | 0.00s |
26 | Snails_AR_Munna | Cpp14 | 0.00s |
27 | giash_uddin | Cpp14 | 0.00s |
28 | HM39 | Cpp14 | 0.00s |
29 | Light_Yagami407 | Cpp14 | 0.00s |
30 | Peregrine_Falcon | Cpp14 | 0.00s |
31 | return_SS | Cpp14 | 0.00s |
32 | gulzar | Cpp14 | 0.00s |
33 | jualahmed | Cpp14 | 0.00s |
34 | mhfarabi09 | Cpp14 | 0.00s |
35 | AlaminJust | Cpp14 | 0.00s |
36 | junayedmahmud | Cpp14 | 0.00s |
37 | Saimum_140128 | Cpp14 | 0.00s |
38 | afzalul | Cpp14 | 0.00s |
39 | anik_JU | Cpp14 | 0.00s |
40 | zitul_mahmud | Cpp14 | 0.00s |
41 | hafizur_acb | Cpp14 | 0.00s |
42 | Tajir | Cpp14 | 0.00s |
43 | mh4746 | Cpp14 | 0.00s |
44 | lolcoder | Cpp14 | 0.00s |
45 | soumitro_cse1604114 | Cpp14 | 0.00s |
46 | mrinmoi | Cpp14 | 0.00s |
47 | noyonhossen | Cpp14 | 0.00s |
48 | Alamgir_Hossain | Cpp14 | 0.00s |
49 | Nasif | Cpp14 | 0.00s |
50 | 1604110 | C | 0.00s |
Copyright © 2015-2016 Dev Skill.