Identify Character Type

You are given a single character ch. Determine whether the character is an uppercase English letter, a lowercase English letter, a digit, or a special character.

Return the corresponding character type according to these rules:

  • "Uppercase" if ch is an uppercase English letter (A–Z).
  • "Lowercase" if ch is a lowercase English letter (a–z).
  • "Digit" if ch is a digit (0–9).
  • "Special Character" for any other printable ASCII character.

Example 1:

Input:

ch = 'A'

Output:

Uppercase

Explanation:

A is an uppercase English letter, so the output is Uppercase.

Example 2:

Input:

ch = '7'

Output:

Digit

Explanation:

7 is a numeric digit, so the output is Digit.

Now Your Turn!

Pick the correct output for the given input

Input:

ch = '#'

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • ch is a printable ASCII character (ASCII values 32–126).

Hints

Frequently Occurring Doubts

Interview Follow-up Questions

0
class Solution {
public:
string identifyCharacterType(char ch) {
// Write your code here
}
};
 
Test Case

Input:

Ch