using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Numerics; class Program { static void Main() { string S = Console.ReadLine(); int[] Numbers = Array.ConvertAll(S.ToCharArray(), r => int.Parse(r.ToString())); Console.WriteLine(Numbers.Max() - Numbers.Min()); } }