https://www.acmicpc.net/problem/9086
문자열을 쪼개 배열에 저장해서 처음과 끝을 출력하였다.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i = 0; i < n; i++){
String s = sc.next();
String arr[] = s.split("");
System.out.println(arr[0] + arr[s.length() - 1]);
}
sc.close();
}
}