def compress_string(string):
    # TODO: Implement me
    string += "!"
    res = ""
    prev = string[0]
    curr 
    if 
    
    pass

"""
Explanation: <small><i>This notebook was prepared by Donne Martin. Source and license info is on GitHub.</i></small>
Challenge Notebook
Problem: Compress a string such that 'AAABCCDDDD' becomes 'A3B1C2D4'.  Only compress the string if it saves space.

Constraints
Test Cases
Algorithm
Code
Unit Test
Solution Notebook

Constraints

Can we assume the string is ASCII?
Yes
Note: Unicode strings could require special handling depending on your language


Can you use additional data structures?  
Yes


Is this case sensitive?
Yes



Test Cases

None -> None
'' -> ''
'AABBCC' -> 'AABBCC'
'AAABCCDDDD' -> 'A3B1C2D4'

Algorithm
Refer to the Solution Notebook.  If you are stuck and need a hint, the solution notebook's algorithm discussion might be a good place to start.
Code
End of explanation
"""


# %load test_compress.py
from nose.tools import assert_equal


class TestCompress(object):

    def test_compress(self, func):
        assert_equal(func(None), None)
        assert_equal(func(''), '')
        assert_equal(func('AABBCC'), 'AABBCC')
        assert_equal(func('AAABCCDDDD'), 'A3B1C2D4')
        print('Success: test_compress')


def main():
    test = TestCompress()
    test.test_compress(compress_string)


if __name__ == '__main__':
    main()

"""
Explanation: Unit Test
The following unit test is expected to fail until you solve the challenge.
End of explanation
"""


