문제 출처 https://www.acmicpc.net/problem/2675
내가 작성한 코드
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int n = Integer.parseInt(br.readLine());
for(int i=0; i<n; i++) {
StringTokenizer st = new StringTokenizer(br.readLine());
int co = Integer.parseInt(st.nextToken()); //첫번째 토큰에 반복의 수
String s = st.nextToken(); //두번째 토큰에 문자열
for(int j=0; j<s.length(); j++) {
char ch = s.charAt(j);
for(int z=0; z<co; z++) {
bw.write(ch);
}
}
bw.newLine(); //한줄 건너뛰기
}
bw.flush();
bw.close();
}
}