#encodings=utf-8
l1=[]
l2=[]
l3=[]
num=1
f=open('t1.txt','r')
s=f.readlines()
print(s)
c_1 = len(s[0])
print(c_1)
c_2 = len(s[1])
print(c_2)
c_3 = len(s[2])
print(c_3)
for i in s:
for j in i:
if num<=c_1 and num==1:
l1.append(j)
if num<=c_2 and num==2:
l2.append(j)
if num<=+c_3 and num==3:
l3.append(j)
num+=1
num_=-1
for i in l1:
num_+=1
if i=='\n':
l1.pop(num_)
num_=-1
for i in l2:
num_+=1
if i=='\n':
l2.pop(num_)
num_=-1
for i in l3:
num_+=1
if i=='\n':
l3.pop(num_)
l1_=[]
l2_=[]
l3_=[]
num_1=len(l1)-1
for i in range(0,len(l1)):
l1_.append(l1[num_1])
num_1-=1
num_1=len(l2)-1
for i in range(0,len(l2)):
l2_.append(l2[num_1])
num_1-=1
num_1=len(l3)-1
for i in range(0,len(l3)):
l3_.append(l3[num_1])
num_1-=1
s1=''.join(l1_)
s2=''.join(l2_)
s3=''.join(l3_)
s1=s1+'\n'
s2=s2+'\n'
list_=[]
list_.append(s1)
list_.append(s2)
list_.append(s3)
print(list_)
f=open('t2.txt','w')
f.writelines(list_)