#1935

Maximum Number of Words You Can Type

newbie · 145 · lc easy +13 · premium · verified · 82.9% accepted · 994 likes · top 94%

Description

Some keyboard keys are broken. Given a string text of space-separated words and a string brokenLetters listing all non-working keys, return the count of words in text that can be typed without using any broken key.

Example 1:

Input: text = "hello world", brokenLetters = "ad"
Output: 1
Explanation: We cannot type "world" because the 'd' key is broken.

Example 2:

Input: text = "leet code", brokenLetters = "lt"
Output: 1
Explanation: We cannot type "leet" because the 'l' and 't' keys are broken.

Example 3:

Input: text = "leet code", brokenLetters = "e"
Output: 0
Explanation: We cannot type either word because the 'e' key is broken.

Code

1
2
3