#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
string convert(string s, int numRows) {
string ping;
int shu = 0;
int fan = 1;
vector<string> res(numRows);
if (numRows == 1) {//当行数为1直接返回本身就是
return s;
}
for (int i = 0; i < s.length(); i++) {
res[shu] = res[shu]+s[i];
shu = shu + fan;
if (shu==numRows-1||shu==0) {
fan = -fan;
}
}
for (int b = 0; b < numRows; b++) {
ping = ping + res[b];
}
cout << ping << endl;
return s;
}
};
int main() {
Solution sol;
string s = "PAYPALISHIRING";
s=sol.convert(s, 3);
}