diff options
Diffstat (limited to 'challenge-273/ulrich-rieke/cpp/ch-2.cpp')
| -rwxr-xr-x | challenge-273/ulrich-rieke/cpp/ch-2.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/challenge-273/ulrich-rieke/cpp/ch-2.cpp b/challenge-273/ulrich-rieke/cpp/ch-2.cpp new file mode 100755 index 0000000000..27cf48fd06 --- /dev/null +++ b/challenge-273/ulrich-rieke/cpp/ch-2.cpp @@ -0,0 +1,16 @@ +#include <iostream>
+#include <string>
+
+int main( ) {
+ std::cout << "Enter a word!\n" ;
+ std::string word ;
+ std::cin >> word ;
+ std::string result { "false" } ;
+ auto pos = word.find( 'b' ) ;
+ if ( pos != std::string::npos ) {
+ if ( word.substr( pos + 1 ).find( 'a' ) == std::string::npos )
+ result = "true" ;
+ }
+ std::cout << result << '\n' ;
+ return 0 ;
+}
|
