#P0003. 首字母大写
首字母大写
1. Problem Description
Given an input string, the task is to output its version with the first letter capitalized.
String operations that may be used in this problem:
| Operation | Description |
|---|---|
str.find(sub) |
Finds the first occurrence of the substring sub in str. Returns -1 if not found. |
str.replace(old, new) |
Returns a new string where all occurrences of old in str are replaced with new. |
str.upper() |
Converts all letters in str to uppercase. |
str.lower() |
Converts all letters in str to lowercase. |
str.strip(chars) |
Returns a new string with chars removed from the beginning and end of str. |
str.startswith(sub) |
Checks if str starts with sub. |
str.endswith(sub) |
Checks if str ends with sub. |
2. Input and Output
Input Method:
- Use
input()to read the input. Note that the input is a string and needs to be processed manually.
Output Method:
- Use
print()to output a string.
Input and Output Examples
# Input:
ibookS
# Output:
IbookS