题解 | #编排字符串#
编排字符串
https://www.nowcoder.com/practice/42c0673f04b34f66ae236a1cb7995532
#include <iostream> #include <vector> using namespace std; vector<string> v; int main(){ int m; cin>>m; while(m--){ string s; cin>>s; v.insert(v.begin(), s); for(int i = 0; i < v.size() && i < 4; i ++){ cout<<i + 1<<"="<<v[i]<<' '; } cout<<endl; } return 0; }
vector insert 用法