Search⌘ K

Solved Problem - Compare Numbers

Discover how to compare very large numbers represented as strings in C++. Learn to efficiently remove leading zeros and apply length-based and digit-wise comparison to determine which number is greater or if they are equal, even for inputs up to a million digits long.

Problem statement

Given two very long integers AA and BB. You have to determine which is bigger or if they are equal. Leading zeroes are allowed.

Input format

The first line contains a non-negative integer, AA.

The second line contains a non-negative integer, BB.

AA,BB may contain leading zeroes. Each of them ...