1324. Print Words Vertically Medium
1/**
2 * [1324] Print Words Vertically
3 *
4 * Given a string s. Return all the words vertically in the same order in which they appear in s.<br />
5 * Words are returned as a list of strings, complete with spaces when is necessary. (Trailing spaces are not allowed).<br />
6 * Each word would be put on only one column and that in one column there will be only one word.
7 *
8 *
9 * Example 1:
10 *
11 *
12 * Input: s = "HOW ARE YOU"
13 * Output: ["HAY","ORO","WEU"]
14 * Explanation: Each word is printed vertically.
15 * "HAY"
16 * "ORO"
17 * "WEU"
18 *
19 *
20 * Example 2:
21 *
22 *
23 * Input: s = "TO BE OR NOT TO BE"
24 * Output: ["TBONTB","OEROOE"," T"]
25 * Explanation: Trailing spaces is not allowed.
26 * "TBONTB"
27 * "OEROOE"
28 * " T"
29 *
30 *
31 * Example 3:
32 *
33 *
34 * Input: s = "CONTEST IS COMING"
35 * Output: ["CIC","OSO","N M","T I","E N","S G","T"]
36 *
37 *
38 *
39 * Constraints:
40 *
41 *
42 * 1 <= s.length <= 200
43 * s contains only upper case English letters.
44 * It's guaranteed that there is only one space between 2 words.
45 *
46 */
47pub struct Solution {}
48
49// problem: https://leetcode.com/problems/print-words-vertically/
50// discuss: https://leetcode.com/problems/print-words-vertically/discuss/?currentPage=1&orderBy=most_votes&query=
51
52// submission codes start here
53
54impl Solution {
55 pub fn print_vertically(s: String) -> Vec<String> {
56 vec![]
57 }
58}
59
60// submission codes end
61
62#[cfg(test)]
63mod tests {
64 use super::*;
65
66 #[test]
67 fn test_1324() {
68 }
69}
70
Back
© 2025 bowen.ge All Rights Reserved.