I wrote a code to output the number of times the letter 'a' is repeated within a given length of a list, it works perfectly with an input of the length less than 1000000 but there is no output with a length larger than 1000000. I would really appreciate the help.
Code:
n = int(input("Length: "))
s = list(input("String: "))
a = s
for i in s:
if len(a) < n:
a.append(i)
print(a.count("a"))
print(a)
For an example if the inputs such as below are given the code won't be executed
Length: 100000000000000
String: abcasc
I also noticed that my computer freezes when another app is opened/running while this program is running.