알고리즘/백준

백준 4458 첫 글자를 대문자로

고구마와 감자 2022. 12. 7. 22:08

https://www.acmicpc.net/problem/4458

 

4458번: 첫 글자를 대문자로

첫째 줄에 줄의 수 N이 주어진다. 다음 N개의 줄에는 문장이 주어진다. 각 문장에 들어있는 글자의 수는 30을 넘지 않는다. 모든 줄의 첫 번째 글자는 알파벳이다.

www.acmicpc.net

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < N; i++) {
            String str = br.readLine();
            sb.append(Character.toUpperCase(str.charAt(0)) + str.substring(1)).append("\n");
        }
        sb.setLength(sb.length() - 1);
        System.out.println(sb);
    }
}