rle3(S) = RLE => rle3(S.tail(),S[1],1,[],RLE). rle3([],LastChar,Count,RLE1,RLE) => RLE = (RLE1 ++ [Count.to_string(),LastChar.to_string()]).join(''). rle3([C|T],LastChar,Count,RLE1,RLE) => C == LastChar -> rle3(T,C,Count+1,RLE1,RLE) ; rle3(T,C,1,RLE1++[Count.to_string()++LastChar.to_string()],RLE).