#K65747. Multiply String Numbers

    ID: 32266 Type: Default 1000ms 256MiB

Multiply String Numbers

Multiply String Numbers

Given two non-negative integers represented as strings num1 and num2, compute their product and return it as a string.

Note: You are not allowed to convert the inputs directly into integers. Instead, you should simulate the multiplication process similar to the way we perform multiplication by hand. The algorithm involves multiplying each digit of the first number with each digit of the second number and combining the results appropriately. In mathematical terms, if you consider the digits of num1 as \(a_i\) and the digits of num2 as \(b_j\), then the final product is computed using a formula like:

\(\text{Result} = \sum_{i,j} a_i \times b_j \times 10^{(i+j)}\)

inputFormat

The input consists of two lines. The first line contains the string representation of a non-negative integer num1. The second line contains the string representation of a non-negative integer num2.

outputFormat

Output a single line containing the product of num1 and num2, also as a string.## sample

2
3
6