Advertisement
Spocoman

01. Reverse Strings

Nov 19th, 2023
784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     string word;
  8.     cin >> word;
  9.  
  10.     while (word != "end") {
  11.         string reversed = word;
  12.         reverse(reversed.begin(), reversed.end());
  13.         cout << word << " = " << reversed << endl;
  14.         cin >> word;
  15.     }
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement