LCC/Moose '20 Contest 3 S1 - Peculiar Polling

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type

After losing the election for CEO of MCPT to Erfan, Theodore, furious of his loss, has decided to sue MCPT over voter irregularities. In his case, Theodore argues that a candidate gaining more than one consecutive vote is evidence that the voting machine has been tampered with (an irregularity) and only 1 should be counted.

To see if this case's merits should be heard, the court has asked you to perform an audit using Theodore's description of an irregularity and to report the new totals.

Input Specification

The first line consists of a single integer, N (1 \le N \le 10^6), the number of votes counted.

The second consists of N ASCII capital letters, the votes cast before auditing. Each character represents a vote cast for the candidate of that character.

Output Specification

For each candidate who received more than 1 vote output a single line containing the name of the candidate and the number of votes they separated by a space.

The order in which the candidates appear is irrelevant.

Sample Input 1


Sample Output 1

A 7
B 6

Sample Input 2


Sample Output 2

T 1


There are no comments at the moment.