Algorithm/SWEA
15230. 알파벳 공부 JAVA
Bonita SY
2023. 1. 5. 23:59
728x90
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class SWEA15230 {
public static final String alpabet = "abcdefghijklmnopqrstuvwxyz";
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine());
for (int i = 1; i <=T; i++) {
String str = br.readLine();
int correct_cnt = 0;
for (int x=0; x<str.length(); x++) {
if (str.charAt(x) != alpabet.charAt(x)) {
break;
}
correct_cnt += 1;
}
System.out.printf("#%d %d\n", i, correct_cnt);
}
}
}
728x90