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.

Recommended Answers

All 3 Replies

the 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)

Thanks! I tried using it but the compiler fails to recognize this function. Is it present in the stdlib?

Is the usage like,
check_flag = find_first_not_of(abc) ;
//where to I give the string to be compared?

Can you pls gimme the exact protype for this function find_first_not_of( )?

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.