#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
using namespace std;
string fstwrd; char c_;
int sec, trd;
int trans(string a)//把字符串变成数字
{
int res;
for (int i = 0; i < a.size(); i++)
{
res = pow(10, i) * (a[i] - '0');
}
return res;
}
int weishu(int a) {//计算位数
a = fabs(a); int x = 0;
if (a == 0) return 1;
while (a) {
a /= 10;
x++;
}
return x;
}
int main()
{
int n; cin >> n;int len;
for (int i = 0; i < n; i++) {
cin >> fstwrd;
switch (fstwrd[0]) {
case'a':c_ = fstwrd[0]; cin >> sec >> trd;
len = weishu(sec) + weishu(trd) + weishu(sec + trd);
printf("%d+%d=%d\n%d", sec, trd, sec + trd, len + 2); break;
case'b':c_ = fstwrd[0]; cin >> sec >> trd;
len = weishu(sec) + weishu(trd) + weishu(sec - trd);
printf("%d-%d=%d\n%d", sec, trd, sec - trd, len + 2); break;
case'c':c_ = fstwrd[0]; cin >> sec >> trd;
len = weishu(sec) + weishu(trd) + weishu(sec * trd);
printf("%d*%d=%d\n%d", sec, trd, sec * trd, len + 2); break;
default:
cin >> trd; sec = trans(fstwrd);
switch(c_) {
case'a': len = weishu(sec) + weishu(trd) + weishu(sec + trd);
printf("%d+%d=%d\n%d", sec, trd, sec + trd, len + 2); break;
case'b': len = weishu(sec) + weishu(trd) + weishu(sec - trd);
printf("%d-%d=%d\n%d", sec, trd, sec - trd, len + 2); break;
case'c': len = weishu(sec) + weishu(trd) + weishu(sec * trd);
printf("%d*%d=%d\n%d", sec, trd, sec * trd, len + 2); break;
default:break;
}
break;
}
printf("\n");
}
return 0;
}
求大佬拯救啊