插入字符的位置数量为 (|s|+1),每个位置插入可以看做恰好与后一个字符相同而重复。时间复杂度 (O(|s|))。
code:
#include<bits/stdc++.h> using namespace std; string s; int main() { cin>>s; cout<<(s.size()+1)*26-s.size(); return 0; }