Go Back

Count Valid Words from String

Codesignal
Developer
Problem Description
Given a string and a list of valid letters, count how many words in the string can be formed using the letters in the valid letters list. For the input string, words are split using spaces. Punctuation and numbers are always considered valid letters. Both uppercase and lowercase are invalid for letters not present in the input list. Example: Input: String: "Hello, I am h2ere!" Letters: "heloiar" Output: 3 Explanation: Valid words: "Hello,", "I", "h2ere!". Invalid word: "am" (as 'm' is not present in the list of valid letters).
Hints

No hints available for this question.