# Include <iostream>
Using namespace STD;
// Reconnection deduplication Algorithm
Void trytolink (char * Str)
{
Char * pcur = STR;
// Char * POS [20] = {0 };
Char ** Pos = (char **) malloc (sizeof (char *) * (strlen (STR) + 1 ));
Memset (Pos, '\ 0', strlen (STR) + 1 );
// Char * pnodes = (char *) nodes;
Bool state = 0;
Size_t Index = 0;
// Int J = 0;
If (! (* Pcur ))
{
Return;
}
// Location-only Algorithm
// For (Index = 0; index <strlen (STR );)
While (* pcur)
{
// The content is cleared.
If (Index = 0)
{
Pos [0] = pcur ++;
}
If (* POS [Index] = * pcur)
{
State = 1;
Pcur ++;
Continue;
}
Else
{
If (State = 1)
{
Index --;
State = 0;
Continue;
}
Else
{
Index ++;
Pos [Index] = pcur ++;
}
}
}
For (size_t J = 0; j <index; j ++)
{
STR [J] = * POS [J];
};
Delete Pos;
}
Void main ()
{
Char ABC [30] = {"You shoshould sleep at noon ."};
Trytolink (ABC );
Printf ("str: % s", ABC );
System ("pause ");
}