QOJ.ac

QOJ

时间限制: 1.0 s 内存限制: 64 MB 总分: 100

#18079. アナグラムの回避

统计

2つの文字列が、一方の文字を並び替えることで他方と一致する場合、それらはアナグラムであるという。例えば、「listen」と「silent」はアナグラムであるが、「master」と「nearest」はそうではない。

文字列 $s = s_1s_2 \dots s_n$ の部分列とは、 $1 \le a_1 < a_2 < \dots < a_k \le n$ を満たす文字列 $s_{a_1}s_{a_2} \dots s_{a_k}$ のことである。

文字列 $s$ が与えられる。その部分列をいくつか書き出すとき、書き出した文字列のリストの中にアナグラムであるようなペアが存在しないようにできる、部分列の個数の最大値を求めよ。

入力

最大 60 文字の小文字のラテン文字からなる文字列 $s$ が 1 行で与えられる。

出力

答えとなる数値を 1 つ出力せよ。

入出力例

入力 1

jojo

出力 1

8

注記

最初の例において、条件を満たす文字列のリストは「j」、「o」、「jj」、「jo」、「oo」、「jjo」、「joo」、「jojo」となり得る。

入力 2

uralchampionship

出力 2

20735

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.