Loading...
Submission
# When Author Problem Language CPU Memory
20837 2024-06-09 09:18:09 AHAMMED_99 Akash and Cipher Python 3 13 ms 8896 kb Runtime Error - 4
Test Cases
# CPU Memory Points
1 13 ms 8676 kb 1 Accepted
2 13 ms 8748 kb 1 Accepted
3 13 ms 8684 kb 1 Accepted
4 13 ms 8896 kb 0 Runtime Error
5 0 ms 0 kb 0 Skipped
6 0 ms 0 kb 0 Skipped
Source Code
  1. def decrypt_message(n, s, q):
  2. result = ""
  3. for i in range(n):
  4. shift = i + 1 if q[i] == 'U' else -(i + 1)
  5. char_code = ord(s[i]) + shift
  6. if char_code < ord('a'):
  7. char_code += 26
  8. elif char_code > ord('z'):
  9. char_code -= 26
  10. result += chr(char_code)
  11. return result
  12.  
  13. # Read input
  14. T = int(input())
  15. for _ in range(T):
  16. n = int(input())
  17. s = input()
  18. q = input()
  19.  
  20. # Decrypt the message and print the result
  21. print(decrypt_message(n, s, q))
  22.