#栈简单应用#倒序字符串#acwing
https://www.acwing.com/problem/content/description/3578/
#include <iostream> #include <cstdio> #include <stack> #include <string> using namespace std; int main(){ int m; stack<string> Mystack; scanf("%d",&m); for(int i=0;i<m;i++){ char arr[200]={0}; scanf("%s",arr); string str=arr; Mystack.push(str); stack<string> tmp = Mystack; for(int j=1;j<=4;j++){ if(tmp.empty()) break; printf("%d=%s ",j,tmp.top().c_str()); tmp.pop(); } printf("\n"); } return 0; }