<jupyter_start><jupyter_text>说明：    给定一个字符串s。    垂直返回所有单词，顺序与它们在s中出现的顺序相同。    单词以字符串列表形式返回，必要时以空格结尾。 （不允许使用尾随空间）。    每个单词将仅放在一列上，而在一列中将只有一个单词。Example 1:    Input: s = "HOW ARE YOU"    Output: ["HAY","ORO","WEU"]    Explanation: Each word is printed vertically.                  "HAY"                 "ORO"                 "WEU"Example 2:    Input: s = "TO BE OR NOT TO BE"    Output: ["TBONTB","OEROOE","   T"]    Explanation: Trailing spaces is not allowed.                 "TBONTB"                "OEROOE"                "   T"Example 3:    Input: s = "CONTEST IS COMING"    Output: ["CIC","OSO","N M","T I","E N","S G","T"] Constraints:    1、1 <= s.length <= 200    2、s contains only upper case English letters.    3、It's guaranteed that there is only one space between 2 words.<jupyter_code>class Solution:
    def printVertically(self, s: str):
        s_list = s.split(' ')
        max_len = max([len(x) for x in s_list])
        word_list = []
        for i in range(max_len):
            res = []
            for item in s_list:
                if len(item) <= i:
                    res.append(' ')
                else:
                    res.append(item[i])
            while res[-1] == ' ':
                res.pop()
            word_list.append(''.join(res))
        return word_list
solution = Solution()
solution.printVertically("CONTEST IS COMING")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12974910394265232, 'fraction_numerical': 0.008602150537634409, 'mean_word_length': 1.9451476793248945, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '309706', 'license': 'Apache-2.0', 'n_tokens_mistral': 511, 'n_tokens_neox': 505, 'n_words': 118, 'path': 'String/1012/1324. Print Words Vertically.ipynb', 'repo_name': 'YuHe0108/Leetcode', 'size': '1395'}