[Codeup] 26045: 6-13 string comparison Problem

Title Description
Compares two strings s1 and s2 of the size, if s1> s2, outputs a positive number; if s1 = s2, and outputs 0; if s1 <s2, a negative output.

Requirements: not strcpy function; two string gets function reads.

For example: "A" as compared with "C", because "A" < "C", the output should be negative, and because the "A" and "C" of the ASCII code difference is 2, the output should be "-2."

Similarly: "And" and the "Aid" comparison, the results of comparison of the second character, "n" ratio "i" is five, and therefore should output "5"

Input
Input line string 2

Output
an integer, which represents the difference of the two string comparison, a separate line.

Sample input
And
Aid

Sample Output
5

AC Code
Here Insert Picture Description

Released four original articles · won praise 0 · Views 106

Guess you like

Origin blog.csdn.net/niwenroudelian/article/details/104350551