#include <stdio.h>
#include <stdlib.h>
int n;
typedef struct LNode
{
char data;
struct LNode* next;
}LNode;
void initLinkList(LNode* pL)
{
int i = 0;
LNode* pR, * pS;
scanf("%d", &n);
getchar();
pR = pL;
for (i = 0; i < n; i++)
{
pS = (LNode*)malloc(sizeof(LNode));
pS->next = NULL;
scanf("%c", &pS->data);
pR->next = pS;
pR = pS;
}
}
int opLinkList(LNode* pLA, LNode* pLB)
{
LNode* pQ, * pR, * pS;
pQ = pLA->next;
while (pQ != NULL)
{
pS = (LNode*)malloc(sizeof(LNode));
pS->data = pQ->data;
pS->next = pLB->next;
pLB->next = pS;
pQ = pQ->next;
}
}
void dispLinkList(LNode* pL)
{
LNode* pR;
pR = pL->next;
while (pR != NULL)
{
printf("%c ", pR->data);
pR = pR->next;
}
}
int main()
{
LNode* pLA, * pLB;
pLA = (LNode*)malloc(sizeof(LNode));
pLA->next = NULL;
pLB = (LNode*)malloc(sizeof(LNode));
pLB->next = NULL;
initLinkList(pLA);
opLinkList(pLA, pLB);
dispLinkList(pLB);
return 0;
}