1 __author__ = 'root'
2 count = input("input total number of name:")
3 name=[]
4 i=1
5 errortimes=1
6 while i <= count:
7 thename=raw_input("please input name %d (format:first name,last name)" %i)
8 a=len(thename)
9 b=thename.index(",")
10 c=thename.count(",")
11 if a >= 5 and b != a and c == 1 and b != 0 and a-b > 2 :
12 #输入字符最短长度为5(xx,xx);“,”不可在首尾;“,”个数为1;“,”后字符个数必须大于1#
13 name.append(thename)
14 i+=1
15 else:
16 print "please input in format!error times %d" %errortimes
17 errortimes+=1
18
19 for j in sorted(name):
20 print j