-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1935.cpp
More file actions
36 lines (27 loc) · 681 Bytes
/
1935.cpp
File metadata and controls
36 lines (27 loc) · 681 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<iostream>
#include<sstream>
#include<string>
int canBeTypedWords(std::string text, std::string brokenLetters) {
int count = 0;
std::istringstream iss(text);
std::string word;
while (iss >> word) {
bool check = true;
for (const auto& ch : brokenLetters) {
if (word.find(ch) != std::string::npos) {
check = false;
break;
}
}
if (check) {
++count;
}
}
return count;
}
int main() {
std::string text = "hello world";
std::string brokenLetters = "ad";
std::cout << canBeTypedWords(text, brokenLetters);
std::cin.get();
}