Pagini recente » Cod sursa (job #1691787) | Cod sursa (job #2443400) | Cod sursa (job #2754220) | Cod sursa (job #245058) | Cod sursa (job #936948)
Cod sursa(job #936948)
#include <fstream>
#include <iostream>
#include <string>
#include <iterator>
#include <algorithm>
#include <ext/hash_map>
#define MAX_WORD_SIZE 16
#define MAXN 36003
using namespace std;
using namespace __gnu_cxx;
namespace __gnu_cxx
{
template<> struct hash< std::string >
{
size_t operator()( const std::string& x ) const
{
return hash< const char* >()( x.c_str() );
}
};
}
typedef hash_map<string, unsigned short> string_hash_map;
string_hash_map hmUniques;
int main()
{
int n;
short table[26];
string word;
fstream fin("restante.in", fstream::in);
fstream fout("restante.out", fstream::out);
fin >> n;
//cout << n << endl;
for (int i=0; i<n; ++i)
{
fin >> word;
//cout << word << " ";
sort(word.begin(), word.end());
//cout << word << endl;
hmUniques[word]++;
}
unsigned short numUniques = 0;
for (string_hash_map::const_iterator it = hmUniques.begin();
it != hmUniques.end();
it++)
{
//cout << it->first << " " << it->second << endl;
if (it->second == 1)
{
numUniques++;
}
}
fout << numUniques << "\n";
return 0;
}