Speak the opposite language (c ++ implementation) and speak the opposite Language
Description: given an English sentence, you must write a program to output all words in the sentence in reverse order.
Input: The test input contains a test case that contains a string of no more than 80 characters in a row. A string consists of several words and spaces. A word is a string consisting of uppercase and lowercase letters. Words are separated by one space, enter no extra spaces at the end of the sentence.
Output: the output of each test case occupies one line, and the inverted sentence is output.
Inout: Hello World Here I Come
Output: Come I Here World Hello
You must be familiar with the functions in string.
1 # include <iostream> 2 # include <string> 3 using namespace std; 4 5 int main () 6 {7 string a, B, c; 8 getline (cin, a); 9 for (int I = 0; I <. size (); I ++) 10 {11 if (a [I] = '') 12 {13 c. push_back (''); 14 B. insert (0, c); // string insert function 15 c. erase (0); // delete function 16 continue; 17} 18 c. push_back (a [I]); 19} 20 c. push_back (''); 21 B. insert (0, c); 22 B. erase (B. size ()-1); 23 cout <B <endl; 24 system ("pause"); 25 return 0; 26}