Question one hundred and nineteen: simple Encoding

Source: Internet
Author: User

[Plain] Description
 
 
Translate a string of text into a password. The password rules are as follows:
 
The original lowercase letters are all translated into uppercase letters, and all uppercase letters are translated into lowercase letters. The following describes how to translate numbers:
0 --> 9
1 --> 8
2 --> 7
3 --> 6
4 --> 5
5 --> 4
6 --> 3
7 --> 2
8 --> 1
9 --> 0
 
Then, the order of all characters is reversed.
 
 
Input
 
Enter a string of text. The maximum number of characters cannot exceed 100.
 
Output
 
Output the encoded result.
 
Sample Input
 
 
China
 
Sample Output
 
 
ANIHC

Description


Translate a string of text into a password. The password rules are as follows:

The original lowercase letters are all translated into uppercase letters, and all uppercase letters are translated into lowercase letters. The following describes how to translate numbers:
0 --> 9
1 --> 8
2 --> 7
3 --> 6
4 --> 5
5 --> 4
6 --> 3
7 --> 2
8 --> 1
9 --> 0

Then, the order of all characters is reversed.


Input

Enter a string of text. The maximum number of characters cannot exceed 100.

Output

Output the encoded result.

Sample Input


China

Sample Output


ANIHC


[Plain] # include <stdio. h>
# Include <string. h>
 
Int main ()
{
Int I;
Int length;
Char string [101];
 
Gets (string );
Length = strlen (string );
 
For (I = 0; I <length; I ++)
{
If (string [I] <= 'Z' & string [I]> = 'A ')
{
String [I] = string [I]-32;
}
Else if (string [I] <= 'Z' & string [I]> = 'A ')
{
String [I] = string [I] + 32;
}
Else if (string [I] <= '9' & string [I]> = '0 ')
{
String [I] = '9'-string [I] + '0 ';
}
}

For (I = length-1; I> = 0; I --)
{
Printf ("% c", string [I]);
}
 
Return 0;
}

# Include <stdio. h>
# Include <string. h>

Int main ()
{
Int I;
Int length;
Char string [101];

Gets (string );
Length = strlen (string );

For (I = 0; I <length; I ++)
{
If (string [I] <= 'Z' & string [I]> = 'A ')
{
String [I] = string [I]-32;
}
Else if (string [I] <= 'Z' & string [I]> = 'A ')
{
String [I] = string [I] + 32;
}
Else if (string [I] <= '9' & string [I]> = '0 ')
{
String [I] = '9'-string [I] + '0 ';
}
}

For (I = length-1; I> = 0; I --)
{
Printf ("% c", string [I]);
}

Return 0;
}

 
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.