class Solution {
public:
int numDistinct(string S, string T) {
// Note: The Solution object is instantiated only once and is reused by each test case.
vector< vector > dp;
vector row(S.length()+1,0);
vector ones(S.length()+1,1);
int i,j;
if(S.length()