[ create a new paste ] login | about

Link: http://codepad.org/aCHEkQUg    [ 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", "lol") ? "True" : "False") << std::endl;
 
    return 0;
}
 
bool check(std::string first, std::string two)
{
    std::sort(first.begin(), first.end());
    std::sort(two.begin(), two.end());
 
    if(two.length() < first.length())
        return false;
    else if(first == two)
        return true;
    else
        for(size_t i = 0; i < first.length(); ++i)
            if(first.at(i) != two.at(i))
                return false;
    
    return true;
}


Output:
1
False


Create a new paste based on this one


Comments: