oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

countalp Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

countalp.html

Spongebob is having a cryptography lesson today! Today's lesson is about substitution cipher (http://en.wikipedia.org/wiki/Substitution_cipher), which is a method of encryption whereby every alphabet is replaced by another alphabet.

Cracking a code encrypted by substitution is rather easy due to the flaws of the English Language. This is because certain letters are more frequently used than others. For example: E is used 11% of the time while Q is only used 0.2%.

As such, Spongebob's teacher, wants spongebob to investigate the frequency of letters of the language used in Bikini-Bottom. However, there might be thousands of letters, making it very boring for Spongebob to count one by one.

Your Task:

Create a program that count the number of time every letter appears.

Input

The first line of input will be a single integer, n
n is the total number of letters that follow and 0 < n < 25001.
The second line of input will be n letters.
The lettes will all be in lowercase and there are no spaces in between them.

Output

Output the corresponding frequency of each letter, A-Z.
Refer to sample output for more details.

Sample Input

36
thequickbrownfoxjumpedoverthelazydog

Sample Output

a 1
b 1
c 1
d 2
e 4
f 1
g 1
h 2
i 1
j 1
k 1
l 1
m 1
n 1
o 4
p 1
q 1
r 2
s 0
t 2
u 2
v 1
w 1
x 1
y 1
z 1

Tags

String Processing

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
1100101s32MBAverage
2011s32MBAverage

Judge Compile Command

g++-8 ans.cpp -o countalp -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.