[ create a new paste ] login | about

Link: http://codepad.org/ZKLPqEsU    [ raw code | output | fork ]

C++, pasted on Jun 14:
#include <iostream>
#include <string>
#include <algorithm>
 
bool check(std::string first, std::string two);
 
int main()
{
    std::cout << (check("hello", "loll") ? "True" : "False") << std::endl;
 
    return 0;
}


bool check(std::string first, std::string two)
{
    for(size_t i = 0; i < two.length(); ++i)
        if(first.find(two.at(i)) == std::string::npos)
            return false;
    else
        first[i] = '0'; //black magic.
 
    return true;
}


Output:
1
True


Create a new paste based on this one


Comments: