Last active
January 30, 2016 15:41
-
-
Save Jamesits/01abcb0e23b4a4ef53fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <regex> | |
#include <fstream> | |
#include <string> | |
using namespace std; | |
int main() { | |
std::ifstream ifs("sample.in"); | |
std::string var((std::istreambuf_iterator<char>(ifs)), | |
(std::istreambuf_iterator<char>())); | |
const regex r("answer=\"(.+?)\""); | |
smatch sm; | |
auto params_it = std::sregex_iterator(var.cbegin(), var.cend(), r); | |
auto params_end = std::sregex_iterator(); | |
while (params_it != params_end) { | |
auto param = params_it->str(); | |
std::regex_match(param, sm, r); | |
std::cout << sm[1] << std::endl; | |
++params_it; | |
} | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="row"> | |
<div class="span10"> | |
<p>Remember, the <strong>only thing</strong> before everything, is to have a dogma. A dogma is a list consists by DOs and DONTanswer="C"s. You make it, stick to it while adapt it to reality, question yourself from time to time: is everything on the list mutuallanswer="A"y exclanswer="B"usive and collectively eanswer="B"xanswer="C中文"haus再来点中文ive?</p> | |
<p>And there is a meta dogma for dogmas:</p> | |
<ul> | |
<li>Avoid emotional tactics</li> | |
<li>Every kindness counts</li> | |
<li>Gentleness is the ultimate strength</li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ clang++ -std=c++11 -stdlib=libc++ -O2 -Wall main.cpp | |
$ ./a.out | |
C | |
A | |
B | |
B | |
C中文 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment