1. Create a class that recieves a list of words in constructor
2. Define a function that finds minimum distance between given pairs of words(given as indices) in the list
3. Return this distance
4. Input and output is handled for you
5. It is a functional problem ,please do not modify main()
Input Format
Input is handled for you.
Output Format
Output is handled for you.
Constraints
Assume the pairs have distinct words
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
8 pep coding best peace pep excellence pursuit coding 3 2 3 5 4 1 5
Output
1 1 2