슈콩

[SWEA] 알파벳 공부 본문

Algorithms/SWEA

[SWEA] 알파벳 공부

shukong 2025. 11. 14. 23:08

 

 

[문제]

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AYLnMQT6vPADFATf

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

 

 

[소스 코드]

import java.io.*;
import java.util.*;
public class Solution {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int T = Integer.parseInt(br.readLine());
		for(int tc=1;tc<=T;tc++) {
			String s = br.readLine();
			int result = 0;
			for(int i=0;i<s.length();i++) {
				if((s.charAt(i)-'a')==i){
					result++;
				}
				else break;
			}
			System.out.println("#"+tc+" "+result);
		}
	}
}

'Algorithms > SWEA' 카테고리의 다른 글

[SWEA] 사랑의 카운슬러  (0) 2025.11.15
[SWEA] 신뢰  (0) 2025.11.15
[SWEA] 힙  (0) 2025.11.14
[SWEA] 제로  (0) 2025.11.14
[SWEA] 안경이 없어!  (0) 2025.11.14