#include <iostream>
#include <string>
using namespace std;

int main() {
    string str1, str2;
    while (cin >> str1 >> str2) { 
        int res=0;// 注意 while 处理多个 case
        for(int i=0;i<str1.length();i++){
            for(int j=0;j<str2.length();j++){
                int m=str1[i]-'0';
                int n=str2[j]-'0';
                res+=m*n;
            }
        }
        cout<<res;
    }
}

关键点:数字字符减去'0',就等于其对应的int类型的数字;

int res = '4'-'0'; //res==4;