abc = [int(x) for x in list(input())] print(max(abc) - min(abc))