Convert String to Uppercase

TCS NQT Coding Easy Go Ad-Free - ₹20/mo

Write a program or function that takes a string as input and converts all lowercase alphabetic characters (a-z) to their uppercase equivalents (A-Z). Non-alphabetic characters (such as digits, symbols, and spaces) and already uppercase letters should remain unchanged.

Examples:

Input: "hello"

Output: "HELLO"

Explanation: All lowercase letters 'h', 'e', 'l', 'l', 'o' are converted to uppercase.

Input: "TcS NqT!"

Output: "TCS NQT!"

Explanation: Mixed case string: 'T' and 'S' remain uppercase, 'c' and 'q' and 't' are converted to 'C', 'Q', 'T', and '!' remains unchanged.

Input: "123abc DEF"

Output: "123ABC DEF"

Explanation: Digits '123' and space remain same, 'abc' converted to 'ABC', and 'DEF' already uppercase remains unchanged.

Constraints

  • 1 ≤ length of string ≤ 1000 characters
  • String can contain any printable ASCII characters (including letters, digits, symbols, and spaces)
  • Conversion applies only to lowercase English letters (a-z); other characters are preserved