class Solution {
public:
string multiply(string num1, string num2) {
int data[100000]={0};
reverse(num1.begin(),num1.end());
reverse(num2.begin(),num2.end());
int n=num1.size();
int m=num2.size();
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
data[i+j]+=(num1[i]-'0')*(num2[j]-'0');
}
}
int tmp=0;
int carry=0;
int k=0;
while(k<m+n-1||carry!=0)
{
tmp=data[k]+carry;
data[k]=tmp%10;
carry=tmp/10;
k++;
}
bool flag=0;
string ret;
for(;k>=0;k--)
{
if(flag==0&&data[k]==0)
continue;
else
{
flag=1;
ret+=(char)(data[k]+'0');
}
}
if(flag==0)
return "0";
else return ret;
}
};
public:
string multiply(string num1, string num2) {
int data[100000]={0};
reverse(num1.begin(),num1.end());
reverse(num2.begin(),num2.end());
int n=num1.size();
int m=num2.size();
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
data[i+j]+=(num1[i]-'0')*(num2[j]-'0');
}
}
int tmp=0;
int carry=0;
int k=0;
while(k<m+n-1||carry!=0)
{
tmp=data[k]+carry;
data[k]=tmp%10;
carry=tmp/10;
k++;
}
bool flag=0;
string ret;
for(;k>=0;k--)
{
if(flag==0&&data[k]==0)
continue;
else
{
flag=1;
ret+=(char)(data[k]+'0');
}
}
if(flag==0)
return "0";
else return ret;
}
};