You hopefully have read the rules, no homework help unless you show some effort. This is an easy algorithm, you just implement. You are going to need some simple variables, the count, the previous letter, the current letter and the output string/stream.
Loop over the input string/stream and compare the next letter with the last letter, if it is not the same write out the last letter + the count (if not 1), reset the count and update the last_letter variable. Some care is needed for when you read in a number.
Improvements can be made in the compression ratio with a wide number of things, e.g. a symbol to mean to stop compression until the next copy of the symbol etc. Discussion of what happens when you double compress.
When I have set stuff like this I normally give about 50% extra marks for the unasked for extras. [Which allows a mark out out 140 and a carry over to other parts of the course. :) ]. So think about how to improve the algorithm, for your input data, when the compression works, what sort of break even data exists, and what happens with pure-random data.
So when you have some code , post it here in code tags, and give a brief outline of the problems, e.g. expected output and actual output, and we will comment and provide some help [if we are able to].