Files
CodeTest/leetcode/length-of-last-word/solution_1387080735.rs

5 lines
150 B
Rust

impl Solution {
pub fn length_of_last_word(s: String) -> i32 {
s.trim().split(' ').collect::<Vec<_>>().pop().unwrap().len() as i32
}
}