1935. 可以输入的最大单词数
class Solution {
public:
int canBeTypedWords(string text, string brokenLetters) {
unordered_set<char> brokenSet;
for(auto c: brokenLetters) brokenSet.insert(c);
int res = 0;
bool flag = true;
for(auto c: text){
if(c == ' '){
if(flag) res ++;
else flag = true;
}
else if(brokenSet.count(c)) flag = false;
}
if(flag) res ++;
return res;
}
};