/**
 * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
 *
 * 进行凯撒解密
 * @param password string字符串 旺仔哥哥的密码
 * @param n int整型 每个字符加密过程中错位的次数
 * @return string字符串
 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

char* decodeWangzai(char* password, int n) {
    int len = strlen(password);
    
    for (int i = 0; i < len; i++) {
        // 只处理小写字母
        if (password[i] >= 'a' && password[i] <= 'z') {
            // 凯撒解密:向前移动n位(需要处理循环)
            int offset = (password[i] - 'a' - n) % 26;
            
            // 处理负数情况(循环到z)
            if (offset < 0) {
                offset += 26;
            }
            
            password[i] = 'a' + offset;
        }
        // 非小写字母保持不变
    }
    
    return password;  // ✅ 返回解密后的字符串
}