If your input is "abc". What would be the logic to accept the strings, bca,acb,bac,cab,cba,abc (ie. the same string with chars placed in any order)
and reject all other input strings like aab, cdb, xyz etc ?
Note: The reference string("abc") is not fixed, logic should work for any constant string irrespective of its size.
swets_here
0
Newbie Poster
Recommended Answers
Jump to Postthe string class has a function, find_first_not_of( ), where you can just give it your original string "abc". It searches to find any characters that aren't in the list of the ones you provided. (you would want it to return -1 which means it didn't find any)
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.