Skip to main content
Back to problems
Codeforces
Medium
Arrays
Strings
The Child and Homework

Given a string of homework answers, determine which student(s) should be praised based on the minimum number of incorrect positions.

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

Problem

A child has a list of homework answers represented as a string. Each character corresponds to one task result. Your job is to identify which answer pattern is the best match under the problem’s scoring rule and report the winner.

In the original Codeforces task, you compare the child’s answers against several repeating candidate patterns and choose the one with the fewest mismatches.

Your implementation should read the given sequence, evaluate the mismatch count for each candidate pattern, and output the best option according to the problem’s required tie-breaking rule.

Goal

Find the candidate pattern that fits the child’s homework best.

Input Format

  • The first line contains the homework string.
  • The exact scoring details depend on the candidate patterns defined by the task.
  • Use the provided input as the full source of data.

Output Format

  • Print the identifier of the best matching candidate.
  • If multiple candidates are tied, apply the task’s tie-breaking rule.

Constraints

  • The input size is small enough for a direct simulation.
  • Character comparisons are straightforward and do not require advanced data structures.
Examples
Sample cases returned by the problem API.

Example 1

Input

abcdef

Output

1

Explanation

This is a lightweight illustrative example: the best candidate is the one with the fewest position-wise mismatches.

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.