Fix Names in a Table
You're given a table of customer data that contains names with inconsistent capitalization. Your task is to standardize these names so that the first letter of each name is capitalized, and all other letters are lowercase. This is a common data cleaning task essential for maintaining consistent and readable datasets.
Problem Description
You will be provided with a list of names, where each name is represented as a string. Your goal is to transform each name in the list according to the following rules:
- Capitalize the first letter: The very first character of each name should be converted to its uppercase equivalent.
- Lowercase the rest: All subsequent characters in the name, from the second character onwards, should be converted to their lowercase equivalents.
- Handle empty strings: If an input name is an empty string, it should remain an empty string in the output.
- Handle single-character strings: If an input name is a single character, it should be capitalized.
Your function should return a new list containing the standardized names.
Examples
Example 1:
Input: ["john DOE", "jane smith", "ALICE"]
Output: ["John doe", "Jane smith", "Alice"]
Explanation: "john DOE" becomes "John doe", "jane smith" becomes "Jane smith", and "ALICE" becomes "Alice".
Example 2:
Input: ["peter", "MARY-ANNE", "BOB123"]
Output: ["Peter", "Mary-anne", "Bob123"]
Explanation: Standard capitalization is applied. Note that non-alphabetic characters are not changed by the casing operations.
Example 3:
Input: ["", "a", "B", "cDE"]
Output: ["", "A", "B", "Cde"]
Explanation: Demonstrates handling of empty strings, single characters, and mixed casing.
Constraints
- The input will be a list of strings.
- Each string in the list can contain uppercase letters, lowercase letters, numbers, and special characters.
- The length of the input list will be between 0 and 1000.
- The length of each individual name string will be between 0 and 50.
Notes
- Consider how your chosen language handles character casing for different types of characters (e.g., numbers, symbols). The requirement is specifically for letters.
- Think about an efficient way to process each name string and build the result.