P24965 [AtCoder] [ARC039A] A - B problem
普及-
题目描述

Problem Description

Takahashi came up with the following problem:

  • Given two 3-digit integers $ A $ and $ B $, find $ A - B $.

However, it was too simple, so he modified it to the following problem:

  • Given two 3-digit integers $ A $ and $ B $.
  • You may change one digit of either $ A $ or $ B $, and find the maximum possible value of $ A - B $.

Note that you cannot change the leading digit to $ 0 $. For example, you cannot change $ 123 $ to $ 023 $.

Takahashi is very confident in posing this problem to you. Please give it a try.

Input Format

The input is given from the standard input in the following format:

$ A $ $ B $

One line with two integers $ A(100 ≦ A ≦ 999) $ and $ B(100 ≦ B ≦ 999) $ separated by a space.

Output Format

Output the maximum possible value of $ A - B $ when you can change one digit of either $ A $ or $ B $. Output the result to the standard output, followed by a newline.

Sample Input and Output

Sample Input #1

567 234

Sample Output #1

733

Sample Input #2

999 100

Sample Output #2

899

Sample Input #3

100 999

Sample Output #3

-99

Notes/Hints

Sample Explanation 1

If you change $ A $ from $ 567 $ to $ 967 $, $ A - B $ becomes $ 733 $, which is the maximum value.

Sample Explanation 2

The maximum value of $ A - B $ can also be achieved without making any changes.

Sample Explanation 3

The answer can be negative.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
567 234
样例输出
733