백준 Bronze5 25372 - 성택이의 은밀한 비밀번호

JH·2022년 9월 25일
0

백준 알고리즘

목록 보기
1/29
post-thumbnail

문제

입력

출력

제한

idea

처음 입력받은 수만큼 for문을 돌리도록 하였고 입력받은 문자열의 길이가 6이상 9이하일 때는 'yes' 그 외는 'no'가 출력되도록 하였다.

Code

	import java.util.*;

	public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner scanner = new Scanner(System.in);
		String password;
		int x;
		
		x=scanner.nextInt();
		
		for(int i=0;i<x;i++)
		{
		
		password = scanner.next();
		
		if(password.length()>=6 && password.length()<=9)	
			System.out.println("yes");
		else 
			System.out.println("no");
		}
	}
}

결과

0개의 댓글