diff options
Diffstat (limited to 'challenge-239/ulrich-rieke/cpp/ch-1.cpp')
| -rwxr-xr-x | challenge-239/ulrich-rieke/cpp/ch-1.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/challenge-239/ulrich-rieke/cpp/ch-1.cpp b/challenge-239/ulrich-rieke/cpp/ch-1.cpp new file mode 100755 index 0000000000..cb66d87443 --- /dev/null +++ b/challenge-239/ulrich-rieke/cpp/ch-1.cpp @@ -0,0 +1,24 @@ +#include <iostream>
+#include <string>
+#include <regex>
+
+int main( ) {
+ std::string firstLine ;
+ std::string secondLine ;
+ std::cout << "Enter some strings, separated by blanks!\n" ;
+ std::getline( std::cin , firstLine ) ;
+ std::cout << "Enter some more strings, separated by blanks!\n" ;
+ std::getline( std::cin, secondLine ) ;
+ std::string replace( "" ) ;
+ std::string remove( "\\s+" ) ;
+ std::regex forRemoval( remove ) ;
+ std::string firstConcat ( std::regex_replace( firstLine , forRemoval ,
+ replace )) ;
+ std::string secondConcat( std::regex_replace( secondLine, forRemoval ,
+ replace ) ) ;
+ if ( firstConcat == secondConcat )
+ std::cout << "true\n" ;
+ else
+ std::cout << "false\n" ;
+ return 0 ;
+}
|
