#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define mod 1000000007 #include long long dp[502][502]; using namespace std; string s; long long rec(int i,int j){ if(dp[i][j]!=-1){ return dp[i][j]; } if(i>j){ dp[i][j]=0; return 0; } if(i==j){ dp[i][j]=1; return 1; } if(j==i+1){ dp[i][j]= 2+(s[i]==s[i+1]?1:0); return dp[i][j]; } return (((rec(i+1,j)%mod+rec(i,j-1)%mod)%mod-(rec(i+1,j-1))%mod+mod)%mod+(s[i]==s[j]?1:0)*(rec(i+1,j-1)%mod+1)%mod)%mod; } /* g(i, i) = 1 (i.e. when j = i) g(i, i+1) = 2 + (x[i] == x[i+1]) (i.e. 3 iff adjacent chars are identical, otherwise 2) g(i, j) = 0 when j < i (this new boundary case is needed) g(i, j) = g(i+1, j) + g(i, j-1) - g(i+1, j-1) + (x[i] == x[j])*(g(i+1, j-1)+1) when j >= i+2 */ int main(){ int n,x,i,j,a,b,c; int q; cin >> n >> q; memset(dp,-1,sizeof(dp)); cin >> s; for(int a0 = 0; a0 < q; a0++){ cin>>x; //cout<>i>>j; cout<>a>>b>>c; } } return 0; }