Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

include <stdio.

h>
#include <stdlib.h>
#include <string.h>

int main()
{
char a[1000];
int s = 0;
int l;
printf("Please enter the name:");
fgets(a, sizeof(a), stdin);
int n = strlen(a);
for(int i = 0; i < n; i++){
if(a[i] == a[i-1]){
s++;
}
}
while(s != 0){
for(int i = 0; i < n; i++){
if(a[i+1] == a[i]){
for(int j = i; j < n; j++){
a[j] = a[j+1];
}
s = s - 1;
n = n - 1;
break;
}
else if(a[0] == a[1]){
for(int j = 0; j < n; j++){
a[j] = a[j+1];
}
s = s - 1;
n = n - 1;
break;
}
}
}
l = strlen(a);
a[l-1] = 0;
printf("\"%s\"", a);
}

You might also like