```
class Solution {
public:
string convert(string s, int nRows) {
string ret = "";
if(nRows == 1) return string(s);
int gap = (nRows-1)*2;
for(int i = 0; i < nRows; i++) {
//i-th Row;
int curGap = gap - i*2;
int curPos = i;
while(curPos < s.length()) {
if(curGap == 0) {
curGap = gap-curGap;
continue;
}
ret += s[curPos];
curPos += curGap;
//Change gap
curGap = gap-curGap;
}
}
return ret;
}
};
```