0

Hello! I have a problem. I don't write code fort this task. Can you help me?

Learning that DNA is not a random string, the students of the informatics group who have just entered the Institute of Bioinformatics suggested using a compression algorithm that compresses duplicate characters in a line. Coding is carried out as follows: S = 'aaaabbсaa' is converted to 'a4b2c1a2', that is, groups of identical characters of the original string are replaced by this symbol and the number of its repetitions at that li

21st Aug 2017, 9:24 AM
Елена Дьяченко
Елена Дьяченко - avatar
4 Respostas
21st Aug 2017, 9:49 AM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 2
https://code.sololearn.com/WYuLWKzwa2jv/?ref=app Here I made using JS
21st Aug 2017, 10:04 AM
Kartikey Sahu
Kartikey Sahu - avatar
+ 1
It's called run-length encoding :)
21st Aug 2017, 9:53 AM
Schindlabua
Schindlabua - avatar
0
Is it worth the effort? In your example the new string is hardly shorter?
21st Aug 2017, 9:40 AM
Paul
Paul - avatar