Skip to main content
Back to problems
Codeforces
Easy
Strings
Comparing Strings

Determine whether two strings are equivalent after applying the problem’s comparison rule.

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

Problem

You are given two strings. Decide whether they should be considered the same under the comparison rule described by the task.

A typical version of this problem asks you to compare two strings character by character and print whether they are equal or which one comes first according to lexicographic order, sometimes ignoring letter case. The key idea is to scan both strings directly without any heavy data structure.

What to do

  • Read the two strings.
  • Compare them using the required rule.
  • Output the corresponding result for equality or ordering.

This is a straightforward string-processing exercise that tests careful implementation and attention to comparison details.

Input Format

  • Two strings are provided as input.
  • The exact comparison rule depends on the statement, but it is based on direct string comparison.
  • Strings contain no spaces unless explicitly stated otherwise.

Output Format

  • Print the result of comparing the two strings.
  • If they are equal under the required rule, print the equality answer.
  • Otherwise, print the ordering answer required by the task.

Constraints

  • Strings are small enough to compare in linear time.
  • A direct O(n)O(n) scan is sufficient.
  • Use constant extra space besides the input strings.
Examples
Sample cases returned by the problem API.

Example 1

Input

abc
abc

Output

0

Explanation

The strings are identical, so the comparison result is equality.

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.