// checks for capital and lower case s bool validS(char k){ return 's' == k || 'S' == k; } bool isParselTongue(std::string s) { //"Steve likes to eat pancakes" // solve for capitals. solve for hisses. solve for hissses. // if no s is found, return true if(std::string::npos == s.find('s')){return true;} for(int i = 0;i<s.size();i++){ if (validS(s[i])) { // only one s was found, next character was not s. immediately fail. if(!validS(s[i+1])){return false;} // if we found 2 consecutive s, do not check the second one. else{ // find all consecutive s for(int j= i;j<s.size();j++){ // an s was found, skip it if(validS(s[j])){i++;} // no s found, start checking again else {break;} } } } }// end of i loop // if we have gotten this far, the string is ok return true; }// end of function