class Solution {
    public String solution(String s, int n) {
        String answer = "";
        
        for(int i=0; i<s.length(); i++) { answer += change(s.charAt(i), n); }
        
        return answer;
    }
    
    public String change(char c, int push) {
        if(c>='a' && c<='z') {
            c = (char)(c+push)>'z' ? (char)(c+push-26) : (char)(c+push);
        } else if(c>='A' && c<='Z') {
            c = (char)(c+push)>'Z' ? (char)(c+push-26) : (char)(c+push);
        }
        
        return String.valueOf(c);
    }
}