How can we get a unique start and end index for the selected word in string using indexOf() The issue that I am facing is for repeated word indexOf() always got