Welcome to the form Hasangursoy!

I'd suggest using something like while((c=getchar())!= '*') {, and then put each char into a char array, in order (so you'll need a little i counter variable).

After all the input was in the array (make it 80 char's or so). Then use your compression logic on it to compress it as you want it.

Note that this breaks the bigger problem down, into two smaller parts: 1) get input and 2) then do the compression on it.

Trying to do this all at the same time, may be VERY frustrating!