So I have a task to make C++ ...
Program has to check if its possible to make a word using first words letters.
For instance first word is flower second one is flow.
The answer would be that it is possible to make word flow from word flower. I hope this makes sense ;)
ok, but does it count for the word possible to generate slob? Or pole?

Regardless, the strategy for this is to run the permutations of the letters (unfortunately, pick 1, pick 2, pick 3, ... up to length of the input word) and check each against a word database (spell checker software works here).

you can make it smart, with some rule-based things we know about english, such as no words start with three of the same letter.

There are a ton of programs out there for scrabble type word manipulations. Adaptations of those might bear fruit quickly.
Last edited on
Please note that this is not a homework site. We won't do your homework for you. The purpose of homework is that you learn by doing. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.

We didn't see your attempts to solve this problem yourself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again.

That said, you have two words: List and Test.

There are three possible questions:

1. Every character of Test can be found from List
(i.e. List='one', Test='none', n is in 'one', o is in 'one', n is in 'one', e is in 'one')

2. Every character of Test can be taken from List
(i.e. List='one', Test='none', n is in 'one', o is in 'oe', n is not in 'e')

3. Test is a substring of List. E.g. List='kabbala', Test='abba'. List.find(Test) != string::npos

Different questions, different solutions.
Topic archived. No new replies allowed.