Tap here to switch tabs
Problem
Submissions

Problem: Abbreviating the Product of a Range

Try to solve the Abbreviating the Product of a Range problem.

Statement

You are given two positive integers left and right. Calculate the product of all integers in the inclusive range [[left, right]].

Since the product can be very large, abbreviate it according to the following procedure:

  1. Count the total number of trailing zeros in the product, denoted as CC, and remove all trailing zeros.

  2. Let dd be the number of remaining digits.

    • If d≤10d \leq 10, let SS be the string representing the remaining number.

    • If d>10d > 10, let SS be the concatenation of the first 55 digits of the remaining number, the substring ..., and the last 55 digits of the remaining number.

  3. Concatenate SS, the character e, and the count CC to form the final result <S>e<C>.

Return the string representing the abbreviated product.

Constraints:

  • 1≤1 \leq left ≤\leq right ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Abbreviating the Product of a Range

Try to solve the Abbreviating the Product of a Range problem.

Statement

You are given two positive integers left and right. Calculate the product of all integers in the inclusive range [[left, right]].

Since the product can be very large, abbreviate it according to the following procedure:

  1. Count the total number of trailing zeros in the product, denoted as CC, and remove all trailing zeros.

  2. Let dd be the number of remaining digits.

    • If d≤10d \leq 10, let SS be the string representing the remaining number.

    • If d>10d > 10, let SS be the concatenation of the first 55 digits of the remaining number, the substring ..., and the last 55 digits of the remaining number.

  3. Concatenate SS, the character e, and the count CC to form the final result <S>e<C>.

Return the string representing the abbreviated product.

Constraints:

  • 1≤1 \leq left ≤\leq right ≤104\leq 10^4