백준 #31306번 Is Y a Vowel?

jhj·2024년 2월 17일

백준 JAVA

목록 보기
372/583
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int Ycount = 0;
		int countV = 0;
		
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'a' || s.charAt(i) == 'e' || s.charAt(i) == 'i' || s.charAt(i) == 'o' || s.charAt(i) == 'u') {
				countV++;
			}
			
			if(s.charAt(i) == 'y') {
				Ycount++;
			}
		}
		
		System.out.println(countV + " " + (countV + Ycount));
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글