```
input: "AB"
"2"
output:"A"
expect:"AB"
```

But in my compiler I got "AB"...

Here is my program:

```
string convert(string s, int numRows){
if ((numRows == 1)||(s.length() < numRows))
return s;
string ans = "";
int ls = s.length(), l;
if (numRows == 2)
l = (ls-1)/numRows+1;
else
l = (ls-1)/numRows/2+1;
int i = 1, n = 2 * numRows -2;
for (int k = 0; k <= l; k++)
ans = ans+s[k*n+i-1];
for (i = 2; i < numRows; i++)
for (int k = 0; k <= l; k++){
if (k*n+i-1 < ls)
ans = ans + s[k*n+i-1];
if ((k+1)*n-i+1 < ls)
ans = ans + s[(k+1)*n-i+1];
}
i = numRows;
for (int k = 0; k <= l; k++)
if (k*n+i-1 < ls)
ans = ans+s[k*n+i-1];
return ans;
}
```