理解题意之后的一道完全水题,回复手感可以用
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <cstring>
#include <cmath>
#include <cstdlib>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int t;
scanf("%d",&t);
getchar();
for(int i=0;i<t;i++)
{
int A = 0;
int B = 0;
char a[10];
char b[10];
int flag[10] = {0};
// scanf("%s%s",a,b);
cin>>a>>b;
for(int j=0;j<4;j++)
{
if(a[j]==b[j])
{
A++;
flag[j] = 1;
}
}
for(int j=0;j<4;j++)
{
if(flag[j])
{
continue;
}
for(int k=0;k<4;k++)
{
if(a[j]==b[k])
{
B ++;
}
}
}
printf("%dA%dB\n",A,B);
}
//system("pause");
return 0;
}