Encoding string by grouping repeated letters with itertool library.
[1] Valentyn N Sichkar. Encoding string by grouping repeated letters with itertool library // GitHub platform [Electronic resource]. URL: https://github.com/sichkar-valentyn/String_Encoding_with_Itertools (date of access: XX.XX.XXXX)
Using itertools library to group repeated letters in the string and encode them with the help of function that returns a generator by using key word yield. This task is so called also as basic compressing task.
Algorithm:
- Finding all repeated letters and calculating them.
- Returning encoded string with number + letter.
- No number for letters that are met only once.
Example:
- input string: aaaBBBBBaCCCCcFfff
- Encoded string: 3a5Ba4CcF3f
[1] Valentyn N Sichkar. Encoding string by grouping repeated letters with itertool library // GitHub platform [Electronic resource]. URL: https://github.com/sichkar-valentyn/String_Encoding_with_Itertools (date of access: XX.XX.XXXX)