Skip to main content
Back to problems
Codeforces
Easy
Strings
Arrays
Bar

Determine whether a given string contains only lowercase Latin letters and find the maximum frequency of any character.

Acceptance 0%
Also Available On
Other platform versions and source mappings for the same problem.
Problem Statement

You are given a string. Count how many times each character appears, then report the largest frequency among all characters.

This kind of task is often used as a small warm-up on scanning a string and maintaining counts efficiently.

Input Format

  • A single string ss.
  • The string consists of lowercase Latin letters.

Output Format

  • Output one integer: the maximum number of occurrences of any character in ss.

Constraints

  • 1s1051 \le |s| \le 10^5
  • ss contains only lowercase English letters.
Examples
Sample cases returned by the problem API.

Example 1

Input

abacaba

Output

4

Explanation

The character 'a' appears 4 times, which is the highest frequency.

Premium problem context

Unlock deeper context for this problem

Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.