fork download
  1. def euclid(a,b):
  2.  
  3. while(b):
  4.  
  5. r = a % b
  6. a = b
  7. b = r
  8.  
  9. return a
  10.  
  11. a = int(raw_input())
  12. b = int(raw_input())
  13.  
  14. print euclid(a,b)
  15.  
Success #stdin #stdout 0.01s 7284KB
stdin
123
321
stdout
3