PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
file = open("/usercode/files/books.txt", "r")
x= file.readlines()
names= []
length= len(x)
for i in x:
if length>1:
a= i[0]
b= str(len(i)- 1)
c= a+b
names.append(c)
length-= 1
else:
a= i[0]
b= str(len(i))
c= a+b
names.append(c)
for i in names:
print(i)
file.close()
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run