#B2113. Cyclic ASCII Sum String
Cyclic ASCII Sum String
Cyclic ASCII Sum String
Given a non-empty string s
, form a new sequence called the Friend String as follows: for each consecutive pair of characters from s
, compute the sum of their ASCII values.
The first friend value is computed as
\( a_0 + a_1 \)
the second as
\( a_1 + a_2 \)
, and so on. Note that the last friend value is computed from the last and the first characters, i.e.,
\( a_{n-1} + a_0 \)
where n
is the length of s
and \(a_i\) represents the ASCII value of the \(i^{th}\) character. Output all the friend values separated by a single space.
inputFormat
A single line containing the string s
.
outputFormat
Print the computed friend values separated by a space.
sample
ABC
131 133 132