No.52 A Common String Problem
タグ : / 解いたユーザー数 420
作問者 :
nmnmnmnmnmnmnm
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もしくは右上の雲マークをクリックしてアカウントを作成してください。