1 solutions

  • 0
    @ 2025-3-3 16:33:41

    C++ :

    #include <bits/stdc++.h>
    using namespace std;
    
    int main(){
    	string s,r = "";
    	getline(cin,s);
    	int i;
    	for(i = 0;i < s.size();i++){
    		if(isupper(s[i])){
    			if(s[i] >= 'F' && s[i] <= 'Z'){
    				r += s[i] - 5;
    			}else{
    				r += s[i] + ('V'-'A');
    			}
    		}else{
    			r = r + s[i];
    		}
    	}
    	cout<<r<<endl;
    	 
        return 0;
    }
    
    

    Python :

    def jiemi(b):
        if b.isupper():
            if b=='A':
                return 'V'
            elif b=='B':
                return 'W'
            elif b=='C':
                return 'X'
            elif b=='D':
                return 'Y'
            elif b=='E':
                return 'Z'
            else:
                return chr(ord(b)-5)
        else:
            return b
    str1=input()
    for item in str1:
        print(jiemi(item),end="")
    
    
    • 1

    Information

    ID
    10696
    Time
    1000ms
    Memory
    16MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By