#include<iostream>
#include<cstdio>
using namespace std;
# define Maxsize 100000
struct Node
{
char data;
int next;
}node[Maxsize];
int main()
{
int addr1, addr2; // 分别存放两个单词第一个字母的地址
int n; //总字母数
cout<<"please input the value of addr1 addr2 and n"<<endl;
scanf("%d %d %d", &addr1, &addr2, &n);
int add1 = addr1, add2 = addr2; // add1和add2作为分别指向两个链表的工作指针
int addr;
for(int i=0; i<n; i++) //输入所有结点
{
cout<<"please input the value of addr"<<endl;
cin>>addr;
cout<<"please input the value of data and next"<<endl;
cin>>node[addr].data>>node[addr].next;
}
int length1 = 1, length2 = 1;
while (node[add1].next!=-1) //遍历求链表1长度
{
length1++;
add1=node[add1].next;
}