// codesnip-guard: run_length_encoding #[cfg_attr(any(),rustfmt::skip)]#[doc=" return: \\[(elem, length)\\]"]pub fn run_length_encoding(iter:I)->Vec<(T,usize)>where T:Clone+PartialEq,I:IntoIterator{let mut res=Vec::new();for a in iter.into_iter(){if let Some((p,len))=res.last_mut()&&p==&a{*len+=1;continue;}res.push((a,1));}res}