CF975A.Aramic script

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

In Aramic language words can only represent objects.

Words in Aramic have special properties:

  • A word is a root if it does not contain the same letter more than once.
  • A root and all its permutations represent the same object.
  • The root xx of a word yy is the word that contains all letters that appear in yy in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
  • Any word in Aramic represents the same object as its root.

You have an ancient script in Aramic. What is the number of different objects mentioned in the script?

在阿拉米克语中,单词仅能表示物体。

阿拉米克语的单词具有如下特殊性质:

  • 若一个单词不包含重复字母,则称其为词根。
  • 一个词根及其所有排列均表示同一物体。
  • 单词 yy 的词根 xx 是由 yy 中所有出现过的字母各取一次所组成的单词(即去重后按某种顺序排列)。例如,“aaaa”、“aa”、“aaa”的词根均为“a”,而“aabb”、“bab”、“baabb”、“ab”的词根均为“ab”。
  • 阿拉米克语中的任意单词均与其词根表示同一物体。

你拥有一份古老的阿拉米克语文稿。请问该文稿中提到了多少种不同的物体?

输入格式

The first line contains one integer nn (1≤n≤1031 \leq n \leq 10^3) — the number of words in the script.

The second line contains nn words s1,s2,…,sns_1, s_2, \ldots, s_n — the script itself. The length of each string does not exceed 10310^3.

It is guaranteed that all characters of the strings are small latin letters.

第一行包含一个整数 nn(1≤n≤1031 \leq n \leq 10^3)—— 表示脚本中单词的数量。

第二行包含 nn 个单词 s1,s2,…,sns_1, s_2, \ldots, s_n —— 即脚本本身。每个字符串的长度不超过 10310^3。

保证所有字符串中的字符均为小写拉丁字母。

输出格式

Output one integer — the number of different objects mentioned in the given ancient Aramic script.

输出一个整数——给定的古代阿拉米克文字中提到的不同物体的数量。

输入输出样例

  • 输入#1

    5
    a aa aaa ab abb

    输出#1

    2
  • 输入#2

    3
    amer arem mrea

    输出#2

    1

说明/提示

In the first test, there are two objects mentioned. The roots that represent them are "a","ab".

In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".

在第一个测试中,提到了两个对象,代表它们的根为 “a” 和 “ab”。

在第二个测试中,只有一个对象,其根为 “amer”,其余字符串只是 “amer” 的排列。

输入解题思路,AI测评打分。不知道怎么写?

首页