题目要求:
代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.nextLine();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
String[] s = sc.nextLine().split(" ");
for (int j = 0; j < s.length; j++) {
if (s[j].contains("T")){
sb.append(Integer.valueOf(s[j].charAt(0)) - 64);
}
}
}
System.out.println(sb);
}
}
结果: