SHARE
TWEET

H.py

a guest Oct 20th, 2019 111 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fs = input()
  2. ss = input()
  3.  
  4. maxx1 = int(fs)
  5. minn1 = maxx1
  6. maxx2 = int(ss)
  7. minn2 = maxx2
  8.  
  9. for i in range(1, len(fs)):
  10.     cur = fs[i:] + fs[:i]
  11.     if(cur[0] != '0'):
  12.         cur = int(cur)
  13.         maxx1 = max(maxx1, cur)
  14.         minn1 = min(minn1, cur)
  15.  
  16. for i in range(1, len(ss)):
  17.     cur = ss[i:] + ss[:i]
  18.     if(cur[0] != '0'):
  19.         cur = int(cur)
  20.         maxx2 = max(maxx2, cur)
  21.         minn2 = min(minn2, cur)
  22.  
  23. fir = abs(maxx1 - minn2)
  24. ser = abs(maxx2 - minn1)
  25.  
  26. print(max(fir, ser))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top