問題一覧 > 通常問題

No.52 A Common String Problem

レベル : / AI推定難易度 : 189 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 420
作問者 : nmnmnmnmnmnmnm
お気に入りにしたユーザー ProblemId : 10 / 自分の提出
問題文最終更新日: 2026-06-25 06:43:27
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 44 (順位表) の他の問題:

Problem Statement

You are given a string S.
Take characters one at a time from either the "beginning" or the "end" of the string S,
and, separately from the string they were taken from, concatenate the taken characters in order to build a new string.
The string remaining after a character is taken becomes the new S, and this is repeated until no characters of S remain.

How many different strings can be built this way?

Input

S

S is a string consisting of lowercase letters a to z, with a minimum length of 1 character and a maximum length of 10 characters.

Output

Ans

Output Ans, the number of strings that can be built.
Do not forget the newline at the end.

Sample

Sample 1
Input
abc
Output
4

There are 4 possibilities: abc, acb, cab, cba.

Sample 2
Input
aab
Output
3

There are 3 possibilities: aab, aba, baa.

Sample 3
Input
aaaaaaaaaa
Output
1

No matter how the characters are taken, the only result is aaaaaaaaaa.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。