Anagrams
I am look for a way to generate in C++ all the posible arrangements of letters from a string including adding spaces so I can then check with a library to see if they are valid words and create anagrams possibly involving multiple words
0
Comments
Creating a list of words isn't so bad. However creating a list of sentences would be largely impossible. The reason I'd say that is because not only would you have to create the search routine but then you'd have to determine if it's a sentence.
To get you started the grunt way would be to look at the first letter then compare it to each of the next letters to see if it forms any 2 letter words compared to a dictionary. Then you look at the 2nd letter and compare it to each of the remaining ones, then the 3rd etc.... Next you go back to the beginning and look for 3 letter combination etc.... First though you have to have your database of words to cross reference.
Don't think of it as anagrams so much think of it more as a spell checker then start googling from there.
To see what I mean. There are online Anagram Generators but they create garbage sentences.
http://www.mbhs.edu/~bconnell/cgi-bin/anagram.cgi
actually it does not need to make sense I just want words but all I want is how to generate all the permutations of the input I will check it to see if its valid w/ the dictionary at any point and if it is completely invalid