B - String Too Long Editorial by spheniscine


You need to first collect the input into array(s), and check if the sum of \(l_i\) is greater than \(100\).

Do however note that there is a possibility of overflow, even with the standard 64-bit integer type. You could prevent that by first checking if any \(l_i\) is greater than \(100\), before checking the sum.

Once you’ve verified that the string isn’t too long, you could concatenate the required characters and print it.

posted:
last update: