#K57407. Expanding String

    ID: 30413 Type: Default 1000ms 256MiB

Expanding String

Expanding String

You are given a non-empty string S. Your task is to generate a new string where each character in the input is repeated a number of times corresponding to its position (1-indexed). Formally, for each character S[i] (with i starting from 1), the character should be repeated i times.

In mathematical notation, if the input string is of length n, then the output string T is given by: \[ T = \bigoplus_{i=1}^{n} \underbrace{S[i]S[i]\cdots S[i]}_{i\text{ times}} \] where \( \oplus \) denotes string concatenation.

For example:

  • If S = "abc", then the output is "abbccc" because 'a' is repeated 1 time, 'b' 2 times, and 'c' 3 times.
  • If S = "Abc", then the output is "Abbccc".

Read the input string from standard input and output the expanded string to standard output.

inputFormat

The input consists of a single line containing the string S (1 ≤ |S| ≤ 1000). The string may contain alphabets and/or other printable characters.

Read the input from standard input (stdin).

outputFormat

Output the expanded string as described in the problem statement to standard output (stdout).

## sample
a
a