Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <regex>
  4. using namespace std;
  5.  
  6.  
  7. int main() {
  8. freopen("input.txt", "r", stdin);
  9. freopen("output.txt", "w", stdout);
  10.  
  11. string stroke;
  12.  
  13. regex regular(
  14.  
  15. "([0-1]?[0-9]:[0-5][0-9]([\\s][a|p][m])?)|([2][0-3]:[0-5][0-9]([\\s][a|p][m])?)"
  16.  
  17. );
  18.  
  19. smatch m;
  20.  
  21. while (getline(cin, stroke)) {
  22. while (regex_search(stroke, m, regular)) {
  23. cout << m[0] << endl;
  24. stroke = m.suffix().str();
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement