
[Baekjoon Algorithm] 백준 알고리즘 1152번 단어의 개수
·
Algorithm/Baekjoon
public class Baekjoon1152 { public static void main(String[] args) { //String arr = "The Curious Case of Benjamin Button"; // String arr = "Oh My God"; String arr = "Ah Chiken Ah Chiken Ah Chiken Ah Chiken Ah Chiken Ah Chiken Ah Chiken ".trim(); int space = 0; int result = 0; for(int i = 0; i < arr.length(); i++) { if(arr.charAt(i) == ' ') { space++; } } System.out.print(space + 1); } } // 영어 대소..