# queues medium

The Rotating Password

The vault code is a ring of letters that rotates: left moves the first letter to the end, right moves the last letter to the front. 🔐

You get the starting code and the commands (a list of left / right). Print the final code as one string.

Example:

Input: code = "abcde", commands = ["left", "left", "right"] Output: bcdea

left moves a to the end (bcdea), left moves b to the end (cdeab), then right moves the last letter b back to the front (bcdea).

💡 need a hint?

q-rotating-password.py🔒 given lines are locked — write your code in between
loading...