#include <iostream> #include <cstdio> #include <cstring> using namespace std; int main() { int T; char s1[1010],s2[1010]; cin>>T; for(int q=1;q<=T;q++){ int k,i,j; int l1,l2; int a[1200]={0}; int b[1200]={0}; scanf("%s%s",s1,s2); //OJ是空格输入的,用gets是回车转换下一组数据,按照OJ的标准gets读取了空格发生了错误RE,所以用scanf l1=strlen(s1); l2=strlen(s2); if(l1>=l2) k=l1; else k=l2; for(i=k,j=l1-1;j>=0;i--,j--) a[i] = s1[j]-'0'; for(i=k,j=l2-1;j>=0;i--,j--) b[i] = s2[j]-'0'; for(i=k;i>0;i--){ a[i]+=b[i]; if(a[i]>9){ a[i]-=10; a[i-1]++;} } cout<<"Case "<<q<<":"<<endl; printf("%s + %s = ",s1,s2); if(a[0]){ for(i=0;i<=k;i++){ cout<<a[i];}} else{ for(i=1;i<=k;i++){ cout<<a[i];} } cout<<endl; if(q!=T) cout<<endl; } }