Language: C++

#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <cstring>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
vector <string>ans;
vector <string>m[150];
map<string ,int >index;
int vis[1500];
int n;
char   s[150000];
char tmp[1500];
void gao(int now)
{
     vis[now]=1;
     for(int i=0;i<m[now].size();i++)
     {
         string haha  = m[now][i];
         //printf ("%d\n",index[haha]);
         if (index.count(haha))
         {
             if (vis[index[haha]])
                continue;
             else
                gao(index[haha]);
         }
         else{
            ans.push_back(haha);
         }
     }
}
int main()
{
    while(scanf("%d",&n),n)
    {
            index.clear();
            ans.clear();
            for(int i=0;i<=n;i++)
                m[i].clear();
            memset(vis,0,sizeof(vis));
       for(int i=1;i<=n;i++)
       {
            scanf("%s",s+1);
            int len = strlen(s+1);
            int now=0;
            for (int j=1;j<=len;j++)
            {
                 if (s[j]==':')
                 {
                     tmp[now]=0;
                     now=0;
                     index[string(tmp)] = i;
                     //printf ("%d",index[string(tmp)]);
                     //cout<<string(tmp)<<endl;
                     //cout<<string(tmp)<<endl;
                 }
                 else if (s[j]==',' || s[j]=='.')
                 {
                     tmp[now]=0;
                     now =0;
                     m[i].push_back(string(tmp));

                 }
                 else{
                    tmp[now++]=s[j];
                 }
            }
       }
        gao(1);
        sort(ans.begin(), ans.end());
        ans.resize(unique(ans.begin(), ans.end()) - ans.begin());
        printf ("%d\n", ans.size());
        //for(int i=0;i<ans.size();i++)
            //cout<<ans[i]<<endl;

    }
    return 0;
}

Compiler output:
a.cc:13:18: error: 'std::map<std::__cxx11::basic_string<char>, int> index' redeclared as different kind of entity
   13 | map<string ,int >index;
      |                  ^~~~~
In file included from /usr/include/string.h:462,
                 from a.cc:4:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'void gao(int)':
a.cc:25:20: error: overloaded function with no contextual type information
   25 |          if (index.count(haha))
      |                    ^~~~~
a.cc:27:27: error: no match for 'operator[]' (operand types are '<unresolved overloaded function type>' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   27 |              if (vis[index[haha]])
      |                           ^
a.cc:30:26: error: no match for 'operator[]' (operand types are '<unresolved overloaded function type>' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   30 |                 gao(index[haha]);
      |                          ^
a.cc: In function 'int main()':
a.cc:41:19: error: overloaded function with no contextual type information
   41 |             index.clear();
      |                   ^~~~~
a.cc:57:27: error: no match for 'operator[]' (operand types are '<unresolved overloaded function type>' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   57 |                      index[string(tmp)] = i;
      |                           ^