Skip to content

Instantly share code, notes, and snippets.

Created December 15, 2014 08:38
Show Gist options
  • Select an option

  • Save anonymous/51178d7ab76d07a368b1 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/51178d7ab76d07a368b1 to your computer and use it in GitHub Desktop.
#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