Sir i am not able to write it correctly pls help

pls help me with the correct explanation of the logic

refer this https://ide.codingblocks.com/s/589135

  1. We were supposed to print the strings according to the search query that was given to us.
    for example

if an array of strings is [abc, abcda, affd, afd, ffs] and search query was: “a” then we had to print: abc abcda affd and if search query was “af” then we had to print: affd afd

pls share the ques once… maybe i misunderstood

actually i am preparing for my on campus interview and i was reading the interview experiences of a company and in that article the candidate was asked this question in the interview and i thought it can be done using tries and i wrote the code but got stuck so i asked it as a doubt :
so the question is lets say we have h array of strings : [abc, abcda, affd, afd, ffs] and we take a string named s1 as input now we have to print all the words from the array of strings which have the string s1 as prefix in them…
hope i made the question clear

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.