当前位置:网站首页>N – simple encoding

N – simple encoding

2022-06-25 07:14:00 Python's path to becoming a God

Description

Translate a string of text into a password , The law of passwords is :
Translate all the original lower case letters into upper case letters , All uppercase letters are translated into lowercase letters , The translation rules of numbers are as follows :

0——>9 
1——>8 
2——>7 
3——>6 
4——>5 
5——>4 
6——>3 
7——>2
8——>1 
9——>0 

Then reverse the order of all the characters .

Input

Enter a string of text , The maximum number of characters does not exceed 100.

Output

Output the encoded result .

Sample

Input 

china

Output 

ANIHC

Hint

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main(){
    char code[101];
    int l, i;
    scanf("%s", code);
    l = strlen(code);
    for(i = 0; i < l; i++){
        if(code[i] >= 'A' && code[i] <= 'Z'){
            code[i] += 32;
        }
        else if(code[i] >= 'a' && code[i] <= 'z'){
            code[i] -= 32;
        }
        else if(code[i] >= '0' && code[i] <= '9'){
            code[i] = 105 - code[i];
        }
    }
    for(i = l - 1; i >=0; i--){
        printf("%c", code[i]);
    }
    printf("\n");
    return 0;
}

原网站

版权声明
本文为[Python's path to becoming a God]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202201234081818.html