Validate Hex Colors

The user of a graphic design software wants to apply color to some design elements. This software only accepts hexadecimal color codes. Each hexadecimal color code starts with a '#' symbol and is followed by exactly six hexadecimal characters. Hexadecimal characters are digits from 0 to 9 and letters from A to F. You are asked to write a program that will validate the input string and check if it is a valid hexadecimal color code.
Your program will receive a single line of input that needs to be validated.
The program should print Yes if the input is a valid hexadecimal color code, and No otherwise.
Input
Output
#AABBCC
Yes
AABBCC
No
#12345
No
#GGHHII
No
#123456
Yes

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue