2016 "Baidu Star"-Qualifying (Astar Round1) D

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.