입력 방법이 특이해서 테스트 구현하기가 어려웠다.
import java.io.IOException;
import java.util.Scanner;
import java.util.Vector;
public class bj10820
{
public static void main(String[] args) throws IOException
{
Scanner scanner = new Scanner(System.in);
int lower;
int upper;
int number;
int blank;
int i;
String str;
char currentChar;
Vector<Vector<Integer>> data = new Vector<>();
while(scanner.hasNextLine())
{
Vector<Integer> temp = new Vector<>();
str = scanner.nextLine();
lower = 0;
upper = 0;
number = 0;
blank = 0;
for (i = 0; i < str.length(); i++) {
currentChar = str.charAt(i);
if (currentChar >= 'a' && currentChar <= 'z')
{
lower++;
}
else if (currentChar >= 'A' && currentChar <= 'Z')
{
upper++;
}
else if (currentChar >= '0' && currentChar <= '9')
{
number++;
}
else if (currentChar == ' ')
{
blank++;
}
else
{
;
}
}
temp.add(lower);
temp.add(upper);
temp.add(number);
temp.add(blank);
data.add(temp);
}
for(Vector<Integer> temp : data)
{
System.out.println(temp.get(0) + " "
+temp.get(1) + " "
+temp.get(2) + " "
+temp.get(3));
}
scanner.close();
}
}