問題概要
問題ページ
-  
-  A - Difference Max問題ページへ移動する 
問題文
整数 \(a, b, c, d\) が与えられます。
\(a ≤ x ≤ b,\ c ≤ y ≤ d\) となるように整数 \(x, y\) を選ぶとき、 \(x - y\) の最大値を求めてください。
制約
- 入力は全て整数
- \(-100 ≤ a ≤ b ≤ 100\)
- \(-100 ≤ c ≤ d ≤ 100\)
問題の考察
ACコード
import sys
def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    a, b = list(map(int, input().rstrip('\n').split()))
    c, d = list(map(int, input().rstrip('\n').split()))
    print(max(a, b) - min(c, d))
if __name__ == '__main__':
    solve()