Modified CircularShift to use StringBuilder for performance