View Code of Problem 3924

# include <stdio.h>
# include <string.h>
int main(void)
{
	int len , i , j = 0 ;
	char str[100] , str2[100] = {0};
	scanf("%s",str);
	len = strlen (str);
	str2[0] = str[0];
	for(i = 1 ; i < len ; i++ )
	{
		if(str[i] != str2[j])
		{
			j++;
			str2[j] = str[i];
		}	
	}
	for(i = 0 ; i < j ; i++)
		printf("%c",str2[i]);
	return 0;
}

Double click to view unformatted code.


Back to problem 3924