'''
typedef struct list {
int data;
list* next;
}list;
list* initlist()
{
list* a = new list;
a->data = 0;
a->next = NULL;
return a;
}
void pushback(list** h, int n)
{
list* a = new list;
a->data = n;
a->next = NULL;
list* p = *h;
while (p->next)
{
p = p->next;
}
p->next = a;
(*h)->data++;
}
void printlist(list* a)
{
a = a->next;
while (a)
{
cout << a->data << " " ;
a = a->next;
}
cout << endl;
}
list* connect(list* a, list* b)
{
list* head = a;
list* prev = NULL;
while (a)
{
prev = a;
a = a->next;
}
prev->next = b->next;
head->data += b->data;
return head;
}
void test01()
{
list* a = initlist();
for (int i = 0; i < 5; i++)
{
pushback(&a, i);
}
list* b = initlist();
for (int i = 5; i < 10; i++)
{
pushback(&b, i);
}
list* c = connect(a, b);
printlist(c);
}
int main()
{
//test02();
return 0;
}
'''