标签:
bool checkSame(std::string a, std::string b)
{
constexpr int size = 145;
std::vector<int> count(145);
std::for_each(a.cbegin (), a.cend (), [&](char c){++count[c - ‘ ‘];});
std::for_each(b.cbegin (), b.cend (), [&](char c){--count[c - ‘ ‘];});
return std::find_if(count.cbegin (), count.cend (),
[](int i){return i != 0;}) == count.cend ();
// std::sort(a.begin (), a.end ());
// std::sort(b.begin (), b.end ());
// return a == b;
}
标签:
原文地址:http://www.cnblogs.com/wuOverflow/p/5189840.html