A secret message was written into a grid row by row, but it must be read down the
columns. rows is a list of equal-length strings. Return a list containing one string per
column: the first string is the first character of every row (top to bottom), the second is
the second character of every row, and so on.
Examples
Input: rows = ["abc", "def"]
Output: ["ad", "be", "cf"]
Input: rows = ["x"]
Output: ["x"]
Constraints
0 <= len(rows) <= 50, all rows have the same length between1and50.- Return
[]whenrowsis empty.
Goals
- Swap the roles of the outer and inner loop to read column-wise
- Build strings character by character