-
Title Description:
-
A binary number, each of which is reversed, called the number of the inverse code. Below we define a character's inverse code. If this is a lowercase character, then it is the same distance from the characters ' a ' as its inverse code and the character ' Z ', and if it is an uppercase character, it is the same distance from its inverse code as the character ' Z ', and if it is not in both cases, its counter code is itself.
For example, ' A ' 's inverse code is ' z '; ' C ' 's anti-code is ' x '; ' W ' 's anti-code is ' D '; ' 1 ' is the inverse of ' 1 '; ' $ ' is the inverse code or ' $ '.
The inverse code of a string is defined as the inverse of all its characters. Our task is to calculate the inverse code for a given string.
-
Input:
-
The input each line is a string, and the string length is no more than 80 characters. If the input is only!, indicates the end of the input and does not require processing.
-
Output:
-
For each string entered, output its inverse code, one row for each data.
-
Sample input:
-
Hello jlu-ccst-2011!
-
-
Sample output:
-
Svool qof-xxhg-2011
This problem must be read in by Get (), or presentation Error
1#include <cstdio>2#include <cstdlib>3#include <cstring>4#include <algorithm>5#include <cmath>6 #defineMAX 1027 8 CharTodeal[max];9 intMainintargcChar Const*argv[])Ten { One intN, M, K; A //freopen ("Input.txt", "R", stdin); - gets (todeal); - while(strcmp (Todeal,"!") !=0) { the for(inti =0; I < strlen (todeal); i++) { - if(Todeal[i] >='a'&& Todeal[i] <='Z') { -printf"%c",'a'+'Z'-todeal[i]); - } + Else if(Todeal[i] >='A'&& Todeal[i] <='Z') { -printf"%c",'A'+'Z'-todeal[i]); + } A Else { atprintf"%c", Todeal[i]); - } - } -Puts""); - gets (todeal); - } in return 0; -}
Topic 1105: Inverse Code for strings