#K11161. Extract the Secret Password
Extract the Secret Password
Extract the Secret Password
You are given a string containing several segments formatted as S\(n\)
characters, where n
is a non-negative integer indicating the number of characters following the number that belong to that segment. Your task is to extract the secret password by concatenating each segment in order.
In other words, the input string is made up of several substrings of the form Sntext
, where n
can be any non-negative integer (possibly more than one digit) and text
consists of the next n
characters, which should be appended to the output. Formally, if the string is represented as:
\( s = S n_1 x_1 S n_2 x_2 \ldots S n_k x_k \)
then the output should be:
\( x_1 x_2 \ldots x_k \)
Note that if n
is zero, no characters are extracted for that segment. The string may also contain consecutive segments without any delimiters between them.
inputFormat
The input consists of a single line containing the string s which is composed of segments in the format described above.
Constraints:
- The length of s will be at most 100000 characters.
- The integer
n
in each segment is a non-negative integer and may have multiple digits.
outputFormat
Output the secret password as a single line, which is the result of concatenating the substrings extracted from each segment.
## sampleS3abcS5helloS1x
abchellox