给出一个长度不超过20的字符串 (小写字母组成)
让你插入一个字母(任意位置)
求得到不同字符串的方案
长度为n的字符串 有n+1个空位
....第一个位置有26种。。剩下的位置 只需要和前一个位置避免重复就好。。所以都是25种、、
所以答案就是26+25*n
#include <cstdio> #include <cmath> #include <cstring> #include <string> #include <algorithm> #include <iostream> #include <queue> #include <map> #include <set> #include <vector> using namespace std; char tm[25]; int main() { int n; scanf("%s",tm); n=strlen(tm); int t=26; printf("%d\n",n*25+26); return 0; }