Back
Close

Character Counting (CCCoC)

Statement

 Goal

Find the row that has the most of a given character. Then in that row find which character appears the most.

Characters are case sensitive.

If there is a tie for the row, pick the row which appears first.

If there is a tie for the most common character in the row, return the character with the lowest ascii ordinal value.
Input
c character to find
n number of rows
Output
Most common character in row. Number of times that character appears. These terms are separated by a space, not a newline.
Constraints
1 < n <= 10
0 < row length < 256
Example
Input
a
3
ac
aabbbcc
ad
Output
b 3

Game modes
Shortest

Test cases
Row 2 has most 'a', b appears 3 times in that row Test
Input
a 3 ac aabbbcc ad
Output
b 3

Validator 1 Validator
Input
a 4 ac aabbbcc ad aaaaXXXXX
Output
X 5

Check for provided character Test
Input
a 4 aam aaau aaaaa6 aaaafoiuywqwer
Output
a 5

Validator 2 Validator
Input
b 3 bbbbb bbbbbbb bbbbbb
Output
b 7

Common case Test
Input
o 8 p zoyuirwe oozzzoz asdfghjk 55555555555555555555555555555 8 o2 last_r000000000000000000000000w
Output
z 4

Validator 3 Validator
Input
Y 10 A BbB C DDDDDDDDDDDDDDDDDDDDDD EY F GY YH YI JYYJYJJ
Output
J 4

Tie for row Test
Input
g 3 zg gg 555 5555 ggbbff
Output
5 7

Validator 4 Validator
Input
u 4 u uuuJJJJJ uuuC uZZZZZZZZZZZu7
Output
J 5

Tie in row Test
Input
q 7 a b c qeqeqeeqqe d qe fq
Output
e 5

Validator 5 Validator
Input
i 5 l i ibibiibb bzii hello there
Output
b 4

bigger case double tie Test
Input
z 8 did you ever yyyzzz hear zzzeee the tragedy
Output
y 3

Validator 6 Validator
Input
m 8 aam 3mmmaaa bbmbb fdlk 7zbmmmbb bmoj CodingAme eighth row
Output
a 3

Solution language

Solution

Stub generator input