Last active
July 11, 2023 04:25
-
-
Save bylatt/2bccc1f64bca080ee2e4e785e1830b15 to your computer and use it in GitHub Desktop.
Revisions
-
bylatt revised this gist
Jul 11, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ fn main() { let longest_word = content.split("\n").fold( "", |prev, cur| if cur.len() > prev.len() { cur } else { prev }, ); println!("{longest_word}"); } -
bylatt created this gist
Jul 11, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ use std::fs; fn main() { let content = fs::read_to_string("/usr/share/dict/words").unwrap_or("cannot read file".to_string()); let longest_word = content.split("\n").fold( "", |prev, cur| if prev.len() > cur.len() { prev } else { cur }, ); println!("{longest_word}"); }