Alphabet Wheel Cipher Decrypt

Problem A cipher uses a wheel of uppercase A–Z. Decrypt an encrypted string by replacing each character with the character k positions counter-clockwise on the wheel (Z is 1 counter-clockwise from A).

Input / Output

  • Input: string s of A–Z, int k.
  • Output: decrypted string.

Constraints

  • |s|, k up to 10^5 — reduce k mod 26 once; per-character work O(1).

Example

  • s = "VTAOG", k = 2 → "TRYME" (V→T, T→R, A→Y, O→M, G→E).
asked …
LeaderboardSalaryAccount