fork download
  1. #include <iostream>
  2. #include <regex>
  3. using namespace std;
  4.  
  5. int main() {
  6. string str;
  7. getline(cin, str);
  8.  
  9. regex e("(\\d+)\\s+(\\w+)\\s+(.*)");
  10.  
  11. if (regex_match(str,e))
  12. cout<<"Matched";
  13. else
  14. cout<<"No Match";
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5304KB
stdin
3 tablespoon oil olive
stdout
Matched