Randomly inspired by Numbers Increase While Letters Decrease
Given a list of mixed letters and integers (e.g., ['a', 2, 3, 'b']
) increase the letters by one position in the alphabet (wrapping at z
to a
) and decrease the numbers by 1. For the above example, the output should be ['b', 1, 2, 'c']
.
- The input can be a mixed-type list, a delimited string, a list of strings, etc.
z
wraps toa
, but1
goes to0
, and0
goes to-1
, etc.- The input will only ever be
[a-z]
and integers. You can choose capital letters[A-Z]
as input if that's easier for you. - The input is guaranteed non-empty.
- The input may contain only numbers or only letters.
Examples:
Input
Output
['a', 2, 3, 'b']
['b', 1, 2, 'c']
['a', 'b', 'z']
['b', 'c', 'a']
[-1, 0, 257, 'x']
[-2, -1, 256, 'y']
[0, 3, 1, 20382876]
[-1, 2, 0, 20382875]
Rules and Clarifications
- Input and output can be given by any convenient method.
- You can print the result to STDOUT or return it as a function result.
- The output doesn't have to be the same format as the input (e.g., you could take input as a string and output as a list).
- Either a full program or a function are acceptable.
- If applicable, you can assume the input/output integers fit in your language's native
int
range. - Standard loopholes are forbidden.
- This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.
int
range, so you'd never getInteger.MinValue
as an input. \$\endgroup\$