🎁 Exclusive Offer! Join our
Telegram Channel
to get **special discounts** and updates! 🚀
Question 51 - 100% Working Solution | Buy Now
Description
11 Live
A chat application is building a new immersive feature for their customers to enhance their experience. To train the model for this feature, the developers have prepared a dataset.
In the dataset, there are two columns:
The first column contains a new search term A (a string written without spaces).
The second column contains N unique space-separated words.
Task
The training model is designed to accept both columns as input and return all feasible sentences after inserting spaces in the search term A, such that:
- Each word in the sentence exists in the second column.
- A word from the second column can be used multiple times.
- Each letter from the search term A must be used in forming the sentence.
- The relative positions of the letters in search term A must remain the same in the output.
Input Format
First line: A string searchTermA, representing the search term A without spacing.
Second line: An integer word_size, representing the total number of words in the second column.
Third line: N space-separated words, representing the list of words available for sentence formation.