Is there any reason you're not using std::string.find to find the strings with '1' and '4'? Then you could even use std::string.find_first_of() to possibly see if any characters from string 1 are contained in string 2.

Jim