Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 1.14 KB

File metadata and controls

24 lines (18 loc) · 1.14 KB

String Encoding with Itertools

Encoding string by grouping repeated letters with itertool library.

Reference to:

[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)

Description

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

MIT License

Copyright (c) 2018 Valentyn N Sichkar

github.com/sichkar-valentyn

Reference to:

[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)