Array list operation


i given the below input
if element is i ‘i’ have to push the element into list and if ‘f’ occurs the i have to check the next element of ‘f’ in the list
i g i e i e i k i s f e
Inserting g, e, e, k, s into the list. Frequency of e is 2 in the list.
why i am getting the error and can you correct the code

Can you elaborate your doubt, please, or perhaps, send a link to the question in discussion.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.