unsigned encode( const char* s ) { unsigned result = 0; for( size_t i=0; i!=5; ++i ) result |= 1u << (s[i]-'A'); return result; } int main( void ) { unsigned count[252] = {}; for( 那一百万个字符串 ) ++count[encode(字符串)]; }