class Solution {
public:
    string solve(string s, string t) {
        reverse(s.begin(),s.end());
        reverse(t.begin(),t.end());
        int slen = s.length();
        int tlen = t.length();
        int* ans = new int[slen+tlen+10];
        memset(ans,0,sizeof(ans));
        for(int i  = 0 ; i < slen+tlen ; i++)
        {
            for(int j = 0 ; j <= i ; j++)
            {
                if(j<slen&&i-j<tlen){ans[i]+=(s[j]-'0')*(t[i-j]-'0');}
            }
        }
        int d = 0;
        int i = 0;
        for( i = 0 ; i < slen+tlen-1 || d != 0 ; i++)
        {
            ans[i] = d+ans[i];
            d = ans[i]/10;
            ans[i] = ans[i]%10;
        }
        string sans ="";
        for(int j = 0 ; j < i; j++)
        {
            sans+=char(ans[j]+'0');
        }

        reverse(sans.begin(),sans.end());
        return sans;
    }
};