Developing a Python IDE

As a part of building a new Python IDE, your team has been given a task to design a module that checks if a given string can be a valid Python identifier. Python identifiers are composed of lowercase letters (a to z), uppercase letters (A to Z), underscores (_), or digits (0-9), and cannot start with a digit.
The input contains a single line containing the identifier that needs to be checked.
The program should print YES if the corresponding string is a valid Python identifier, or NO if it isn't.
Input
Output
python
YES
_python
YES
1python
NO
python$identifier
NO
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in