Algorithm

백준 1152번: 단어의 개수

qlyh8 2018. 10. 15. 22:52

문제 출처: https://www.acmicpc.net/problem/1152



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main {
    
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String intput = reader.readLine();
        String[] arr = intput.split(" ");
        int spaceCount = 0;
        
        for(int i=; i<arr.length ; i++)
            if(arr[i].equals(""))
                spaceCount++;
        
        System.out.println(arr.length-spaceCount);
    }
}
cs