Back
Close

Elevator position

Statement

 Goal

Your building is from the A floor to the Z floor. A is the bottom floor; Z is the top floor.

There are several elevators in the building. Each elevator always moves one floor per turn. When an elevator reaches floor A or Z it reverses direction.

You will be given a list of the current positions of the elevators.
When upper case letter the elevator is going upwards.
When lower case letter the elevator is going down.

Please answer the positions and directions of the elevators after the tth turn.

Use the same uppercase/lowercase notation to indicate direction the elevator will move next. ("Z" and "a" are not possible)


ex.
Elevator move
A→B→C→D...
X→Y→z→y...
c→b→A→B...
Input
Line 1: An integer t representing number of turns.
Line 2: eElevator positions.
Output
Line 1: The position of the elevators after tth turns.
Constraints
0 ≤ t ≤ 100
1 ≤ elength ≤ 100
Example
Input
5
ADGJM
Output
FILOR

Game modes
Fastest, Shortest

Test cases
Test 1 Test
Input
5 ADGJM
Output
FILOR

Validator 1 Validator
Input
5 ADGJMM
Output
FILORR

Test 2 Test
Input
1 YzbA
Output
zyAB

Validator 2 Validator
Input
1 YzbAA
Output
zyABB

Test 3 Test
Input
20 bXuRUMpQNfTuGWRY
Output
ThAnksForPlAying

Validator 3 Validator
Input
20 bXuRUMpQNfTuGWRYY
Output
ThAnksForPlAyingg

Test 4 Test
Input
5 BttiEtgdtinsBfrjw
Output
GoodJobCodinGAmer

Validator 4 Validator
Input
5 BttiEtgdtinsBfrjww
Output
GoodJobCodinGAmerr

Solution language

Solution

Stub generator input