Owenzjg @ 2021-09-22 20:38:46
#include <bits/stdc++.h>
using namespace std;
int shua,shub;
void quyou(string a){
int i=2;
shua=0;
shub=0;
for(i=2;a[i]!=' ';i++){
shua=shua*10+a[i]-'0';
}
for(i++;i<a.size();i++){
shub=shub*10+a[i]-'0';
}
}
void qumei(string a){
int i=2;
shua=0;
shub=0;
for(i=0;a[i]!=' ';i++){
shua=shua*10+a[i]-'0';
}
for(i++;i<a.size();i++){
shub=shub*10+a[i]-'0';
}
}
int size(int a ,int b,int he){
int jishu=0;
if(a<0){
a*=-1;
jishu++;
}
while(a!=0){
jishu++;
a/=10;
}
if(b<0){
b*=-1;
jishu++;
}
while(b!=0){
jishu++;
b/=10;
}
if(he<0){
he*=-1;
jishu++;
}
while(he!=0){
jishu++;
he/=10;
}
jishu++;jishu++;
return jishu;
}
int main(){
int n;
cin>>n;
string a;
int i;
char yun;
getline(cin,a);
for(i=0;i<n;i++){
getline(cin,a);
if(a[0]>='a' && a[0]<='c'){
yun=a[0];
quyou(a);
}else{
qumei(a);
}
switch(yun){
case 'a':
cout<<shua<<"+"<<shub<<"="<<shua+shub<<endl;
cout<<size(shua,shub,shua+shub)<<endl;
break;
case 'b':
cout<<shua<<"-"<<shub<<"="<<shua-shub<<endl;
cout<<size(shua,shub,shua-shub)<<endl;
break;
case 'c':
cout<<shua<<"*"<<shub<<"="<<shua*shub<<endl;
cout<<size(shua,shub,shua*shub)<<endl;
break;
}
}
return 0;
}