Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <iostream>#include <cstdio>#include <string>#include <map>using namespace std;#define N 10010#define M 1000int parent[N];map<string, int> strToInt;int strToIntCnt = 1;string name[N];int getData(){string a;cin >> a;if(strToInt.count(a) == 0) {strToInt[a] = strToIntCnt;name[strToIntCnt] = a;strToIntCnt++;return strToIntCnt - 1;}else {return strToInt[a];}}int main()