View Code of Problem 3924

#include <stdio.h>
#include <string.h>
char str[10000000]={'\0'};
int main()
{
	scanf("%s",str);
	long long temp=strlen(str);
	printf("%c",str[0]);
	long long j=1;
	while(j<temp)
	{
		if(str[j]==str[j-1])
		{
			j++;
		}
		else
		{
			printf("%c",str[j]);
			j++;
		}
	}
}

Double click to view unformatted code.


Back to problem 3924