zhangjingxing2012 @ 2022-09-17 21:02:38
#include<bits/stdc++.h>
using namespace std;
int x,y,n;
char op,a[1000],b[1000];
int deal()
{
switch(op)
{
case'+':return x+y;
case'-':return x-y;
case'*':return x*y;
}
}
int main()
{
scanf("%d\n",&n);
while(n--)
{
fgets(a,sizeof(a),stdin);
switch(a[0])
{
case'a':op='+';sscanf(a+2,"%d%d",&x,&y);break;
case'b':op='-';sscanf(a+2,"%d%d",&x,&y);break;
case'c':op='*';sscanf(a+2,"%d%d",&x,&y);break;
default:sscanf(a+2,"%d%d",&x,&y);break;
}
sprintf(b,"%d%c%d=%d",x,op,y,deal());
puts(b);
printf("%d\n",strlen(b));
}
return 0;
}