-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathLOJ118.cpp
40 lines (40 loc) · 1.02 KB
/
LOJ118.cpp
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
36
37
38
39
40
#include <cstdio>
#define CXXREGEX
#ifdef CXXREGEX
#include <regex>
char pat[128], buf[128];
int main() {
while(scanf("%s%s", pat, buf) != EOF) {
puts(std::regex_match(
buf,
std::regex(
pat,
std::regex_constants::ECMAScript |
std::regex_constants::nosubs |
std::regex_constants::
optimize |
std::regex_constants::
__polynomial)) ?
"Yes" :
"No");
}
return 0;
}
#endif
#ifdef GLIBCREGEX
#include <regex.h>
char pat[128], buf[128];
int main() {
while(scanf("%s%s", pat, buf) != EOF) {
regex_t reg;
regcomp(®, pat, REG_EXTENDED);
regmatch_t p;
puts(regexec(®, buf, 1, &p, 0) == 0 &&
p.rm_so == 0 &&
buf[p.rm_eo] == '\0' ?
"Yes" :
"No");
}
return 0;
}
#endif