<gh_stars>0
file = open('children', mode = 'r')
lines = file.readlines()
file.close()

c = []
prev = ""
count = 1
for line in lines:
  if line.strip() == prev.strip():
    count += 1
  else: 
    c.append(count)
    count = 1
  prev = line

#print(c)
#print(len(c))
#print(sum(c))
with open('groups', 'w') as f:
    for item in c:
        f.write("%d\n" % item)

file = open('children', mode = 'r')
lines = file.readlines()
file.close()

c = []
prev = ""
count = 1
for line in lines:
  if line.strip() == prev.strip():
    count += 1
  else: 
    c.append(count)
    count = 1
  prev = line

#print(c)
#print(len(c))
#print(sum(c))
with open('groups', 'w') as f:
    for item in c:
        f.write("%d\n" % item)
#print(c) #print(len(c)) #print(sum(c))