jfz-2023-s473564/TaskA01/run.py

34 lines
841 B
Python

import time
start = time.time()
path = "TaskA01\shakespeare.in"
file = open(path,"r",encoding="utf8")
count = 0
lines_count = 0
used = False
lines = []
all_lines = file.readlines()
for l in all_lines:
lines_count += 1
used = False
for char in l:
if char == "H" and count == 0:
count += 1
elif char == "a" and count == 1:
count += 1
elif char == "m" and count == 2:
count += 1
elif char == "l" and count == 3:
count += 1
elif char == "e" and count == 4:
count += 1
elif char == "t" and count == 5:
count = 0
if used == False:
lines.append(lines_count)
used = True
else:
count = 0
print(lines)
file.close()
end = time.time()
print(end - start)