#C11492. Cumulative ASCII Sum Sequence

    ID: 40814 Type: Default 1000ms 256MiB

Cumulative ASCII Sum Sequence

Cumulative ASCII Sum Sequence

Given a string \(S\), compute the cumulative ASCII sum sequence as follows. For each character in \(S\), obtain its ASCII value and then compute the cumulative sum up to that character. Formally, let \(a_i\) be the ASCII value of the \(i\)-th character of \(S\) (1-indexed). The output is a sequence \(c_i\) defined by:

\(c_i = \sum_{j=1}^{i} a_j\)

For example, if \(S = \texttt{abc}\), then \(a_1=97\), \(a_2=98\), \(a_3=99\), and the cumulative sums are \(97, 97+98=195, 97+98+99=294\). Thus, the output is [97, 195, 294].

inputFormat

A single line containing the string (S). The string may be empty.

outputFormat

Print the cumulative ASCII sum sequence as space-separated integers on a single line. If the input string is empty, output nothing.## sample

abc
97 195 294