Four is the number of letters in the ...: Difference between revisions
Content added Content deleted
(Added Rust solution) |
m (Rust - minor edit) |
||
Line 1,765: | Line 1,765: | ||
fn append(&mut self, s: &str) { |
fn append(&mut self, s: &str) { |
||
let offset = self.string.len(); |
let offset = self.string.len(); |
||
self.string.push_str( |
self.string.push_str(s); |
||
self.words.push((offset, offset + s.len())); |
self.words.push((offset, offset + s.len())); |
||
} |
} |
||
Line 1,772: | Line 1,772: | ||
let mut w = &mut self.words[len - 1]; |
let mut w = &mut self.words[len - 1]; |
||
w.1 += s.len(); |
w.1 += s.len(); |
||
self.string.push_str( |
self.string.push_str(s); |
||
} |
} |
||
fn len(&self) -> usize { |
fn len(&self) -> usize { |