Created
December 15, 2014 08:38
-
-
Save anonymous/51178d7ab76d07a368b1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <boost/algorithm/string.hpp> | |
| bool check(std::string str) { | |
| const std::regex regex("(?:[0-9][a-z][a-z])+"); | |
| return std::regex_match(str, regex); | |
| } | |
| int main() { | |
| std::string input; | |
| std::getline(std::cin, input, '\n'); | |
| std::vector<std::string> parts; | |
| boost::split(parts, input, boost::is_any_of(" ")); | |
| for (auto part: parts) { | |
| std::cout << part << ": " << std::boolalpha << check(part) << std::endl; | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment