https://www.acmicpc.net/problem/1264
1264: 모음의 수
입력은 여러 개의 테스트 케이스와 영문 대소문자, ‘,’, ‘.’, ‘!’, ‘?’의 문장으로 구성된다. 및 공백이 지정되었습니다. 각 행은 최대 255자로 구성됩니다. 입력 끝의 라인
www.acmicpc.net
- 문제

- 설명
먼저 while 문을 통해 “#”이 입력될 때까지 문자열을 입력한 다음 toLowerCase() 메서드를 통해 입력된 문자열을 모두 입력합니다.
소문자로 바꾸고 모음 배열과 비교하여 숫자를 센다.
- 암호
import java.util.*;
public class Main {
public static void main(String() args) {
Scanner sc = new Scanner(System.in);
char arr()= {'a','e','i','o','u'};
while(true) {
String str=sc.nextLine();
if(str.equals("#")) {
break;
}
int count=0;
str=str.toLowerCase();
for(int i=0;i<str.length();i++)
{
for(int j=0;j<arr.length;j++)
{
if(str.charAt(i)==arr(j))
count++;
}
}
System.out.println(count);
}
sc.close();
}
}