755 - 487--3279

来源:互联网 发布:淘宝模板化设置 编辑:程序博客网 时间:2024/05/22 04:49
#include <iostream>#include <map>#include <vector>#include <list>#include <string>using namespace std;int main ( int argc, char * argv[ ] ) {int n, N;cin >> N;for ( n = 0; n < N; n++ ) {if ( n ) cout << endl;int m, M;cin >> M;map<string, int> map_r;for ( m = 0; m < M; m++ ) {string ts;while ( ts == "" || ts[0] == '\n' ) getline ( cin, ts );int pos;while ( ( pos = ts.find("-", 0) ) != string::npos ) ts.erase ( pos, 1 );#define R(X, Y) while ( ( pos = ts.find( #X, 0 ) ) != string::npos ) { ts.erase ( pos, 1 ); ts.insert ( pos, #Y ); }R(A, 2)R(B, 2)R(C, 2)R(D, 3)R(E, 3)R(F, 3)R(G, 4)R(H, 4)R(I, 4)R(J, 5)R(K, 5)R(L, 5)R(M, 6)R(N, 6)R(O, 6)R(P, 7)R(R, 7)R(S, 7)R(T, 8)R(U, 8)R(V, 8)R(W, 9)R(X, 9)R(Y, 9)ts.insert ( 3, "-" );map_r[ ts ] ++;}map<string, int> map_2;for ( auto i : map_r ) {if ( i.second > 1 ) map_2[ i.first ] = i.second;}bool tick = true;for ( auto i : map_2 ) {tick = false;cout << i.first << " " << i.second << endl;}if ( tick ) cout << "No duplicates." << endl;}return 0;}


0 0