문제
https://www.acmicpc.net/problem/1264
1264번: 모음의 개수
입력은 여러 개의 테스트 케이스로 이루어져 있으며, 각 줄마다 영어 대소문자, ',', '.', '!', '?', 공백으로 이루어진 문장이 주어진다. 각 줄은 최대 255글자로 이루어져 있다. 입력의 끝에는 한 줄
www.acmicpc.net
내가 작성한 코드
import java.io.*;
import java.util.*;
public class 백준1264 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String alphabet = "aeiou";
while(true){
String input = br.readLine();
input = input.toLowerCase();
if(input.equals("#")){
break;
}
int count = 0;
for(int i = 0; i<input.length(); i++){
if(alphabet.contains(String.valueOf(input.charAt(i)))){
count++;
}
}
bw.write(Integer.toString(count));
bw.newLine();
}
bw.close();
}
}
'자바 > 백준' 카테고리의 다른 글
[백준 2440] 별 찍기 - 3 (0) | 2022.09.06 |
---|---|
[백준 2083] 럭비 클럽 (0) | 2022.09.06 |
[백준 11654] 아스키 코드 (0) | 2022.09.06 |
[백준 11382] 꼬마 정민 (0) | 2022.09.06 |
[백준 10872] 팩토리얼 (0) | 2022.09.06 |