print hello
#include <iostream>
#include <vector>
using namespace std;
int hwc(string str){
int len=str.length();
vector<vector<int> > d(len,vector<int>(len));
for(int j=0;j<len;j++){
d[j][j]=1;
for(int i=j-1;i>=0;i--){
d[i][j]=d[i+1][j]+d[i][j-1]-d[i+1][j-1];
if(str[i]==str[j])
d[i][j]+=1+d[i+1][j-1];
}
}
return d[0][len-1];
}
int main()
{
string s;
int n;
while(cin>>s){
n=hwc(s);
cout<<n<<endl;
}
return 0;
}
网友评论