Hello,
i need to do a program which takes an input sequence of characters from the alphabet {A,B,C} and compresses it by replacing each subsequence of a particular character by a single occurrence of the character, and the length of the substring.
e.g. Input : AAAAABBBBBBBCCBBBAABBCCCCCS
Output: A5B7C2B3A2B2C5
i dont even know how to start any help please.
i know how to count characters of a user input without an array
here it is:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char ch;
int i=0;
printf("Enter a series of characters\n");
do
{
i++;
scanf("%c", &ch);
}
while(ch!='.');
i--;
printf("Number of characters= %d\n", i);
system("PAUSE");
return 0;
}
any help please
thanks