代码如下(C语言):
#include<stdio.h>
int main()
{
int N;
scanf("%d", &N);
getchar();
char str; //选项
char num; //题目号
char option[4] = {'A', 'B', 'C', 'D'};
int password[N]; //密码
int i, j, k;
for(i = 0; i < N; i++)
{
for(j = 0; j < 4; j++)
{
scanf("%c-%c", &num, &str);
getchar();
if(str == 'T')
{
for(k = 0; k < 4; k++)
{
if(option[k] == num)
{
password[i] = k + 1;
break;
}
}
}
}
}
for(i = 0; i < N; i++)
printf("%d", password[i]);
}