The string"PAYPALISHIRING"is written in a zigzag pattern on a givennumberof rows like this: (you may want to display this pattern in a fixed font for better legibility)
P A H N A P L S I I G Y I R And thenread line by line: "PAHNAPLSIIGYIR" Write the code that will take a stringand make this conversion given a numberof rows:
string convert(stringtext, int nRows); convert("PAYPALISHIRING", 3) should return"PAHNAPLSIIGYIR".