Welcome to an exciting exploration of string manipulation and array operations! In this Unit, we’ll tackle a unique challenge: processing a string and an array in parallel while adhering to specific conditions. This engaging task is part of a mysterious book club's cryptic coding adventure.
Get ready to uncover the secrets of combining string and numerical logic into one seamless solution!
Our goal is to create a unique encoded message and manage an array of numbers simultaneously. Here's what we need to do:
- Replace each letter in a string with the next letter alphabetically. If the letter is
'z'
, wrap around to'a'
. - For an accompanying array of numbers, divide each number by
2
, round the result, and accumulate these rounded values. - Stop processing once the accumulated sum exceeds
20
. - Reverse the updated string to complete the cryptic transformation.
- Return the reversed string and the unprocessed numbers from the array.
For example, given the input string "books"
and the array [10, 20, 30, 50, 100]
:
- Start with an empty string and a sum of
0
. - Process
'b'
(becomes ) and (half is ), sum becomes .
