Question: Write code that identifies the very first item that recurs in the string. Then return the identified item with the index where it first appeared

Write code that identifies the very first item that recurs in the string. Then return the identified item with the index where it first appeared and the very next index where it reoccurred. # for example: input="DXTDXTXDTXD", output={"D": [0, 3]} input="Abssbd", output={"b": [1, 4]} x="ABABAAAECX" , output = ??

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the code and an explanation def findfirstrecurringiteminputstr seen Create an empty dictionary ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!