#K57577. Typing Feasibility Checker
Typing Feasibility Checker
Typing Feasibility Checker
You are given a sentence and a list of malfunctioning keys specified as a comma-separated string. Your task is to determine whether the given sentence can be typed on the keyboard without using any of the malfunctioning keys.
Formally, let \( S \) be the sentence and let \( M \) be the set of malfunctioning keys provided in the input. The sentence can be typed if and only if for every character \( c \) in \( S \), \( c \notin M \). If any character is found in \( M \), you should output NO
; otherwise, output YES
.
Note: Input is read from stdin
and output must be written to stdout
. The keys in the malfunctioning list are provided as a comma-separated string without spaces.
inputFormat
The input consists of two lines:
- The first line contains the sentence \( S \) (a non-empty string).
- The second line contains a comma-separated list of malfunctioning keys \( M \). Each key is a single character.
outputFormat
Output a single line containing YES
if the sentence can be typed without using any of the malfunctioning keys, and NO
otherwise.
hello world
h,e,l
NO