Editorial for Học cách xóa
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
void solve()
{
char s1[100];
scanf("%s", s1);
char newstr[100];
int id = 0;
for(int i = 0; i < strlen(s1); i++){
if(id > 0 && s1[i] != newstr[id-1] || id == 0){
newstr[id] = s1[i];
id++;
}
}
newstr[id] = '\0';
printf("%s", newstr);
}
Comments