update
This commit is contained in:
36
String_manipulation/julia/README.md
Normal file
36
String_manipulation/julia/README.md
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
# Problem 3: String Manipulation
|
||||
# Concepts: String vs &str, slicing, iteration
|
||||
|
||||
# Count words in a string, ignoring punctuation:
|
||||
|
||||
# Input: "Hello, world! How are you?"
|
||||
|
||||
# Output: 5
|
||||
|
||||
# Also return vector of unique words (lowercase, no punctuation)
|
||||
# ---------------------------------------------- 100 --------------------------------------------- #
|
||||
|
||||
function main()
|
||||
text = "Hello, world! How are you?"
|
||||
text_list = split(text, " ")
|
||||
println("$(length(text_list))")
|
||||
end
|
||||
|
||||
|
||||
|
||||
main()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1
String_manipulation/rust/.gitignore
vendored
Normal file
1
String_manipulation/rust/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
target/
|
||||
7
String_manipulation/rust/Cargo.lock
generated
Normal file
7
String_manipulation/rust/Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "rust"
|
||||
version = "0.1.0"
|
||||
67
String_manipulation/rust/README.md
Normal file
67
String_manipulation/rust/README.md
Normal file
@@ -0,0 +1,67 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,60 @@
|
||||
// Problem 3: String Manipulation
|
||||
// Concepts: String vs &str, slicing, iteration
|
||||
|
||||
// Count words in a string, ignoring punctuation:
|
||||
|
||||
// Input: "Hello, world! How are you?"
|
||||
|
||||
// Output: 5
|
||||
|
||||
// Also return vector of unique words (lowercase, no punctuation)
|
||||
/* --------------------------------------------- 100 -------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user