Language: C++

#include <iostream>
#include <map>
#include <string>
using namespace std;

int main(){
	map<int,int> name;
  	int n;
  	cin>>n;
  	for(int i=0;i<n;i++){
      string s;
      cin>>s;
      name[s[0]]+=1;
    }
  	int ans=0;
  	ans+=name["M"]*name["A"]*name["R"]+name["M"]*name["A"]*name["C"]+name["M"]*name["A"]*name["H"]+name["M"]*name["R"]*name["C"]+name["M"]*name["R"]*name["H"]+name["M"]*name["C"]*name["H"]+name["A"]*name["R"]*name["C"]+name["A"]*name["R"]*name["H"]+name["A"]*name["C"]*name["H"]+name["R"]*name["C"]*name["H"];
      
  	cout<<ans<<endl;
}
      


Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: ambiguous overload for 'operator[]' (operand types are 'std::map<int, int>' and 'const char [2]')
   16 |         ans+=name["M"]*name["A"]*name["R"]+name["M"]*name["A"]*name["C"]+name["M"]*name["A"]*name["H"]+name["M"]*name["R"]*name["C"]+name["M"]*name["R"]*name["H"]+name["M"]*name["C"]*name["H"]+name["A"]*name["R"]*name["C"]+name["A"]*name["R"]*name["H"]+name["A"]*name["C"]*name["H"]+name["R"]*name["C"]*name["H"];
      |                  ^
In file included from /usr/include/c++/14/map:63,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; mapped_type = int; key_type = int]' (near match)
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:7: note:   conversion of argument 1 would be ill-formed:
a.cc:16:19: error: invalid conversion from 'const char*' to 'std::map<int, int>::key_type' {aka 'int'} [-fpermissive]
   16 |         ans+=name["M"]*name["A"]*name["R"]+name["M"]*name["A"]*name["C"]+name["M"]*name["A"]*name["H"]+name["M"]*name["R"]*name["C"]+name["M"]*name["R"]*name["H"]+name["M"]*name["C"]*name["H"]+name["A"]*name["R"]*name["C"]+name["A"]*name["R"]*name["H"]+name["A"]*name["C"]*name["H"]+name["R"]*name["C"]*name["H"];
      |                   ^~~
      |                   |
      |                   const char*
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; mapped_type = int; key_type = int]' (near match)
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:7: note:   conversion of argument 1 would be ill-formed:
a.cc:16:19: error: invalid conversion from 'const char*' to 'std::map<int, int>::key_type' {aka 'int'} [-fpermissive]
   16 |         ans+=name["M"]*name["A"]*name["R"]+name["M"]*name["A"]*name["C"]+name["M"]*name["A"]*name["H"]+name["M"]*name["R"]*name["C"]+name["M"]*name["R"]*name["H"]+name["M"]*name["C"]*name["H"]+name["A"]*name["R"]*name["C"]+name["A"]*name["R"]*name["H"]+name["A"]*name["C"]*name["H"]+name["R"]*name["C"]*name["H"];
      |                   ^~~
      |                   |
      |                   const char*
a.cc:16:28: error: ambiguous overload for 'operator[]' (operand types are 'std::map<int, int>' and 'const char [2]')
   16 |         ans+=name["M"]*name["A"]*name["R"]+name["M"]*name["A"]*name["C"]+name["M"]*name["A"]*name["H"]+name["M"]*name["R"]*name["C"]+name["M"]*name["R"]*name["H"]+name["M"]*name["C"]*name["H"]+name["A"]*name["R"]*name["C"]+name["A"]*name["R"]*name["H"]+name["A"]*name["C"]*name["H"]+name["R"]*name["C"]*name["H"];
      |                            ^
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; mapped_type = int; key_type = int]' (near match)
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:7: note:   conversion of argument 1 would be ill-formed:
a.cc:16:29: error: invalid conversion from 'const char*' to 'std::map<int, int>::key_type' {aka 'int'} [-fpermissive]
   16 |         ans+=name["M"]*name["A"]*name["R"]+name["M"]*name["A"]*name["C"]+name["M"]*name["A"]*name["H"]+name["M"]*name["R"]*name["C"]+name["M"]*name["R"]*name["H"]+name["M"]*name["C"]*name["H"]+name["A"]*name["R"]*name["C"]+name["A"]*name["R"]*name["H"]+name["A"]*name["C"]*name["H"]+name["R"]*name["C"]*name["H"];
      |                             ^~~
      |                             |
      |                             const char*
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; mapped_type = int; key_type = int]' (near match)
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:7: note:   conversion of argument 1 would be ill-formed:
a.cc:16:29: error: invalid conversion from 'const char*' to 'std::map<int, int>::key_type' {aka 'int'} [-fpermissive]
   16 |         ans+=name["M"]*name["A"]*name["R"]+name["M"]*name["A"]*name["C"]+name["M"]*name["A"]*name["H"]+name["M"]*name["R"]*name["C"]+name["M"]*name["R"]*name["H"]+name["M"]*name["C"]*name["H"]+name["A"]*name["R"]*name["C"]+name["A"]*name["R"]*name["H"]+name["A"]*name["C"]*name["H"]+name["R"]*name["C"]*name["H"];
      |                             ^~~
      |                             |
      |                             const char*
a.cc:16:38: error: ambiguous overload for 'operator[]' (operand types are 'std::map<int, int>' and 'const char [2]')
   16 |         ans+=name["M"]*name["A"]*name["R"]+name["M"]*name["A"]*name["C"]+name["M"]*name["A"]*name["H"]+name["M"]*name["R"]*name["C"]+name["M"]*name["R"]*name["H"]+name["M"]*name["C"]*name["H"]+name["A"]*name["R"]*name["C"]+name["A"]*name["R"]*name["H"]+name["A"]*name["C"]*name["H"]+name["R"]*name["C"]*name["H"];
      |                                      ^
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; mapped_type = int; key_type = int]' (near match)
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:7: note:   conversion of argument 1 would be ill-formed:
a.cc:16:39: error: invalid conversion from 'const char*' to 'std::map<int, int>::key_type' {aka 'int'} [-fpermissive]
   16 |         ans+=name["M"]*name["A"]*name["R"]+name["M"]*name["A"]*name["C"]+name["M"]*name["A"]*name["H"]+name["M"]*name["R"]*name["C"]+name["M"]*name["R"]*name["H"]+name["M"]*name["C"]*name["H"]+name["A"]*name["R"]*name["C"]+name["A"]*name["R"]*name["H"]+name["A"]*name["C"]*name["H"]+name["R"]*name["C"]*name["H"];
      |                                       ^~~
      |                                       |
      |                                       const char*
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; mapped_type = int; key_type = int]' (near match)
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:7: note:   conversion of argument 1 would be ill-formed:
a.cc:16:39: error: invalid conversion from 'const char*' to 'std::map<int, int>::key_type' {aka 'int'} [-fpermissive]
   16 |         ans+=name["M"]*name["A"]*name["R"]+name["M"]*name["A"]*name["C"]+name["M"]*name["A"]*name["H"]+name["M"]*name["R"]*name["C"]+name["M"]*name["R"]*name["H"]+name["M"]*name["C"]*name["H"]+name["A"]*name["R"]*name["C"]+name["A"]*name["R"]*name["H"]+name["A"]*name["C"]*name["H"]+name["R"]*name["C"]*name["H"];
      |                                       ^~~
      |                                       |
      |                                       const char*
a.cc:16:48: error: ambiguous overload for 'operator[]' (operand types are 'std::map<int, int>' and 'const char [2]')
   16 |         ans+=name["M"]*name["A"]*name["R"]+name["M"]*name["A"]*name["C"]+name["M"]*name["A"]*name["H"]+name["M"]*name["R"]*name["C"]+name["M"]*name["R"]*name["H"]+name["M"]*name["C"]*name["H"]+name["A"]*name["R"]*name["C"]+name["A"]*name["R"]*name["H"]+name["A"]*name["C"]*name["H"]+name["R"]*name["C"]*name["H"];
      |                                                ^
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; mapped_type = int; key_type = int]' (near match)
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:7: note:   conversion of argument 1 would be ill-formed:
a.cc:16:49: error: invalid conversion from 'const char*' to 'std::map<int, int>::key_type' {aka 'int'} [-fpermissive]
   16 |         ans+=name["M"]*name["A"]*name["R"]+name["M"]*name["A"]*name["C"]+name["M"]*name["A"]*name["H"]+name["M"]*name["R"]*name["C"]+name["M"]*name["R"]*name["H"]+name["M"]*name["C"]*name["H"]+name["A"]*name["R"]*name["C"]+name["A"]*name["R"]*name["H"]+name["A"]*name["C"]*name["H"]+name["R"]*name["C"]*name["H"];
      |                                                 ^~~
      |                                                 |
      |                                                 const char*
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; mapped_type = int; key_type = int]' (near match)
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:7: note:   conversion of argument 1 would be ill-formed:
a.cc:16:49: error: invalid conversion from 'const char*' to 'std::map<int, int>::key_type' {aka 'int'} [-fpermissive]
   16 |         ans+=name["M"]*name["A"]*name["R"]+name["M"]*name["A"]*name["C"]+name["M"