07/09/27 05:56:53
>>396
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
struct node {
char element;
struct node *next;
};
int check(struct node *p, struct node *mid)
{
int i, j, n = mid->element - '0';
struct node *temp;
for(i=0, temp = p; temp!=mid; i++, temp=temp->next);
if(i!=n) return 0;
for(i=0; i<n; i++, temp=temp->next) if(temp->next==NULL) return 0;
for(i=0; i<n; i++, p=p->next) {
for(temp=mid, j=0; j<n-i; j++, temp=temp->next);
if(p->element != temp->element) return 0;
}
return 1;
}