Check if a Digit

You are given a single character ch.

  • Check whether the given character is a digit (0–9).
  • If it is a digit, return the string "Digit" (without double quotes), otherwise return "Not Digit" (without double quotes).

Example 1:

Input: ch = '5'

Output: Digit

Example 2:

Input: ch = 'a'

Output: Not Digit

Now Your Turn!

Pick the correct output for the given input

Input: ch = '0'

Still unsure what the problem is asking ?

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

Constraints:

  • Input is a single character
  • Character can be: alphabet, digit, special character

Hints

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

Input:

Ch