codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#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; }
Private
[
?
]
Run code
Submit