题意:给一个全由小写字母组成的字符串,可以在任何一个位置(包括头尾)插入一个小写字母使之变为一个新串。问可以构造出多少种不同的新串。
水题。原串长度为L,则共有L + 1个位置可以插入,每个位置可以有26种插法,共26*(L + 1)种。但注意相邻两个空位插入同为位于这两个相邻空位中间的字母,构造出的新串是一样的,所以答案要减去L,于是最后答案为25*L + 26
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
using namespace std;
int main()
{
char s[30];
while(scanf("%s", s) != EOF)
printf("%d\n", strlen(s)*25 + 26);
return 0;
}