You are viewing a single comment's thread. Return to all comments →
Rust:
fn separateNumbers(s: &str) { for i in 0..s.len() / 2 { let num_curr = s[..=i] .parse::<i64>() .expect("parse failed"); let mut str_beaut = s[..=i].to_string(); let mut num_next = num_curr; while str_beaut.len() < s.len() { num_next += 1; str_beaut.push_str(&num_next.to_string()); } if str_beaut == s { println!("YES {}", num_curr); return; } } println!("NO"); }
Seems like cookies are disabled on this browser, please enable them to open this website
Separate the Numbers
You are viewing a single comment's thread. Return to all comments →
Rust: