Intern — Senior
String compression with counting of consecutive characters
livecode
Task condition
It is necessary to write a function compress1 that transforms a string by collecting consecutive identical characters and replacing them with the character followed by the count of its repetitions. As a result, each group of identical characters should be represented as a character and a number indicating how many times it appears in a row.
// in: "AAAABBBCCDDD"
// out: "A4B3C2D3"
func compress1(src string) string {
return ""
}