728x90
BOJ 4458 첫 글자를 대문자로
문제
문장을 읽은 뒤, 줄의 첫 글자를 대문자로 바꾸는 프로그램을 작성하시오.
시간 제한 : 1 초
메모리 제한 : 128 MB
입력
첫째 줄에 줄의 수 N이 주어진다.
다음 N개의 줄에는 문장이 주어진다.
각 문장에 들어있는 글자의 수는 30을 넘지 않는다.
모든 줄의 첫 번째 글자는 알파벳이다.
출력
각 줄의 첫글자를 대문자로 바꾼뒤 출력한다.
예제 입력 1
5
powdered Toast Man
skeletor
Electra Woman and Dyna Girl
she-Ra Princess of Power
darth Vader
예제 출력 1
Powdered Toast Man
Skeletor
Electra Woman and Dyna Girl
She-Ra Princess of Power
Darth Vader
풀이
n = int(input())
for _ in range(n):
s = list(input())
s[0] = s[0].upper()
print(''.join(s))
728x90
'Algorithm(Python) > 문자열' 카테고리의 다른 글
[Algorithm] 백준 BOJ 2857 FBI(python 파이썬) (0) | 2022.12.30 |
---|---|
[Algorithm] 백준 BOJ 11945 뜨거운 붕어빵(python 파이썬) (0) | 2022.12.29 |
[Algorithm] 백준 BOJ 1225 이상한 곱셈(python 파이썬) (0) | 2022.12.27 |
[Algorithm] 백준 BOJ 5988 홀수일까 짝수일까(python 파이썬) (0) | 2022.12.26 |
[Algorithm] 백준 BOJ 10821 정수의 개수(python 파이썬) (0) | 2022.12.25 |