#include <string>
#include <iostream>
using namespace std;
bool containsStr(const string& sourceStr, const string& searchStr);
int main() {
string source_str = "ThisWillRockYourWorld";
string search_str = "AndMaybeMineToo";
if (containsStr(source_str, search_str))
cout<< "You need to bite your tongue." <<endl;
else
cout<< "I will bite my tongue." <<endl;
return 0;
}
bool containsStr(const string& sourceStr, const string& searchStr)
{
if (searchStr.size() > sourceStr.size())
return false; //since it is not possible for sourceStr to fully contain searchStr since it is shorter
const auto src_end = sourceStr.end(), dst_end = searchStr.end();
for (auto src_it = sourceStr.begin(), dst_it = searchStr.begin(); src_it < src_end; ++src_it)
{
if (*src_it == *dst_it)
{
++src_it;
for (auto dst_it2 = dst_it + 1; dst_it2 < dst_end; ++dst_it2, ++src_it)
{
if (*dst_it2 != *src_it)
break;
}
return true;
}
}
return false;
}