problem Description
The D country where bears live is a country full of respect for human rights. It is so strange that all the people in this country name their names. A person's name is made up of several characters, and the same is true of each string in the result of the full arrangement of these characters. For example, if a person's name is ACM, then AMC, CAM, MAC, MCA, etc. are also the names of this person. In this country, there are not two people with the same name.
Degree bears want to count the number of people in this country, help a bear to design a program that counts how many times each person has been counted before.
Input
This includes a set of test data, the first line containing a positive integerNN, the nextNn line represents nn a name. n n will not exceed 100,000100,000, their name will not exceed 40 bits.
Output
For each name entered, output an integer representing how many times the person was counted.
Sample Input
5ACMMACBBAACMBAB
Sample Output
01021
We change all the words into standard form, and then output them once every time we input.
1#include <stdio.h>2 //#include <bits/stdc++.h>3#include <string.h>4#include <iostream>5#include <math.h>6#include <sstream>7#include <Set>8#include <queue>9#include <map>Ten#include <vector> One#include <algorithm> A#include <limits.h> - #defineINF 0x7fffffff - #defineINFL 0X7FFFFFFFFFFFFFFF the #defineLson l,m,rt<<1 - #defineRson m+1,r,rt<<1|1 - #defineLL Long Long - #defineULL unsigned long Long + using namespacestd; - intMain () + { A intT; atmap<string,int>Q; - Chars[100000]; - while(cin>>t) - { - while(t--) - { inscanf"%s", s); - intn=strlen (s); toSort (s,s+n); +q[s]++; -cout<<q[s]-1<<Endl; the } * } $ return 0;Panax Notoginseng}
2016 "Baidu Star"-Qualifying (Astar Round1) D