fork download
  1. import sys;
  2.  
  3. a = [raw_input() for i in xrange(input())];
  4.  
  5. pos = 0;
  6. while len(set(x[0:pos] for x in a)) < 2:
  7. pos += 1;
  8. print pos - 1;
  9.  
  10.  
  11.  
  12.  
  13.  
  14. import sys;
  15.  
  16. a = [raw_input() for i in xrange(input())];
  17.  
  18. pos = 0;
  19. while True:
  20. ok = True;
  21. c = a[0][pos];
  22. for i in xrange(len(a)):
  23. if a[i][pos] != c:
  24. ok = False;
  25. if not ok :
  26. break;
  27. pos += 1;
  28. print pos;
  29.  
  30.  
Runtime error #stdin #stdout 0.02s 4676KB
stdin
Standard input is empty
stdout
Standard output is empty