fn count_words(s: &str) -> usize {
s.split_whitespace().count()
}
fn main() {
let string1 = "c c++ pascal java c#".to_string();
let string2 = "go rust php javascript swift".to_string();
let words1 = count_words(&string1);
let words2 = count_words(&string2);
if words1 == words2 {
println!("Both strings have the same number of words.");
} else {
println!("The strings have a different number of words.");
}
}
/*
run:
Both strings have the same number of words.
*/