A=list(input()) print(ord(max(A))-ord(min(A)))