Previous Next
0 / 23
Module DEMO-32-108DEMO-C-32

Most Frequent

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a program that finds the character that appears most frequently in a string. If there is a tie, pick the one with the smallest ASCII value.

Constraints

Max string length: 100

Input Format

Input:

String S

Output Format

Output:

Char

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
Quince?8
8
The most frequent character in Quince?8 is 8.
Sample #2
Public sample
Code#7
#
The most frequent character in Code#7 is #.
Sample #3
Public sample
Desktop?6
6
The most frequent character in Desktop?6 is 6.
Sample #4
Public sample
Fix#5
#
The most frequent character in Fix#5 is #.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings