#K72492. Accumulated String Format
Accumulated String Format
Accumulated String Format
Given a string S of length \(n\), create a program that outputs a new string following a specific accumulated pattern. For each character \(s_i\) in S (where \(i\) is the 0-indexed position), produce a substring \(u_i\) defined by:
[ u_i = \mathrm{Cap}(s_i), + ,(\mathrm{Lower}(s_i))^{i} ]
In the above, \(\mathrm{Cap}(s_i)\) represents the uppercase version of \(s_i\) and \((\mathrm{Lower}(s_i))^{i}\) means that the lowercase version of \(s_i\) is repeated \(i\) times. The final answer is the concatenation of these substrings using hyphens (-
) as separators.
Example:
- If \(S = \texttt{abcd}\), then the output should be \(A-Bb-Ccc-Dddd\).
inputFormat
The input consists of a single line containing the string \(S\). \(S\) may include letters, digits, and symbols.
outputFormat
Output the accumulated format string following the rule described in the problem statement.
## sampleabcd
A-Bb-Ccc-Dddd