使用set/hash_set去除相同的密码
牛客网好像hash_set编译不通过
#include <iostream>
#include <string>
#include <numeric>
#include <hash_set>
using namespace std;
#define debug_
int func(string str)
{
if (str.size()==1)
{
return 1;
}
if (str.size() == 0)
{
return -1;
}
hash_set<string> my_set;
string tmp;
for (auto i = 0; i < str.size();++i)
{
tmp = str;
tmp.erase(tmp.begin() + i);
my_set.insert(tmp);
}
return my_set.size();
}
int main()
{
string str;
#ifdef debug_
str = "AABA";
#else
cin>>str;
#endif
cout<<func(str);
return 0;
}