I have multiple similar looking strings like this:
s1 = 'carrots12509600apple2950950'
s2 = 'zebra77899967apple5557880'
I want to find a way to index the starting point of the word apple
, meaning I want to find the n
which returns:
s1[n] = a
Given that all strings have the word apple
, and it is between two numbers, is there a way to find the starting point of the substring 'apple' in each string? The length of numbers before and after the word apple
is also the same for each string, but not the character before the number before apple
.