QOJ.ac

QOJ

Límite de tiempo: 1.0 s Límite de memoria: 64 MB Puntuación total: 100

#18079. 避免變位詞

Estadísticas

若兩個字串其中一個可以透過字母重排變成另一個,則稱這兩個字串互為變位詞(anagram)。例如,「listen」與「silent」互為變位詞,但「master」與「nearest」則不是。

字串 $s = s_1s_2 \dots s_n$ 的子序列為字串 $s_{a_1}s_{a_2} \dots s_{a_k}$,其中 $1 \le a_1 < a_2 < \dots < a_k \le n$。

給定字串 $s$,請找出其子序列所能組成的最大數量,使得列表中沒有任何一對字串互為變位詞。

輸入格式

輸入包含單一行,為字串 $s$,長度至多為 60 個小寫拉丁字母。

輸出格式

輸出一個數字,即為答案。

範例

輸入 1

jojo

輸出 1

8

輸入 2

uralchampionship

輸出 2

20735

說明

在第一個範例中,結果列表中的字串可以是:「j」、「o」、「jj」、「jo」、「oo」、「jjo」、「joo」、「jojo」。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.