How to find minimum distance between two words in a string.Can anyone help ?
1012

Given a String and two words (which occur in the given string), find the minimum distance between two words. Distance between two words is defined as the number of characters between the given two words’ middle characters.

I tried to find the distance between those words but how to find exact distance between middle characters.

Comments (2)