diff --git a/src/problem/mod.rs b/src/problem/mod.rs index a7dd1b9..bfcc23c 100644 --- a/src/problem/mod.rs +++ b/src/problem/mod.rs @@ -21,4 +21,5 @@ mod p82_remove_duplicates_from_sorted_list_ii; mod p2719_count_of_integers; mod p2744_find_maximum_number_of_string_pairs; mod p2171_removing_minimum_number_of_magic_beans; -mod p2809_minimum_time_to_make_array_sum_at_most_x; \ No newline at end of file +mod p2809_minimum_time_to_make_array_sum_at_most_x; +mod p2788_split_strings_by_separator; \ No newline at end of file diff --git a/src/problem/p2788_split_strings_by_separator.rs b/src/problem/p2788_split_strings_by_separator.rs new file mode 100644 index 0000000..e9a722b --- /dev/null +++ b/src/problem/p2788_split_strings_by_separator.rs @@ -0,0 +1,38 @@ +/** + * [2788] Split Strings by Separator + */ +pub struct Solution {} + + +// submission codes start here + +impl Solution { + pub fn split_words_by_separator(words: Vec, separator: char) -> Vec { + let mut result = Vec::new(); + + for s in &words { + for i in s.split(separator) { + let word = String::from(i); + + if word.is_empty() { + continue; + } + + result.push(word) + } + } + + result + } +} + +// submission codes end + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_2788() { + } +}