Language: C++

#include <iostream>
using namespace std;

int main(){
  int n;
  cin >> n;
  string a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  long long int m,a,r,c,h;
  for(int i=0;i<n;i++){
    if(a[i].at(0)=='M'){
      m++;
    }
    else if(a[i].at(0)=='A'){
      a++;
    }
    else if(a[i].at(0)=='R'){
      r++;
    }
    else if(a[i].at(0)=='C'){
      c++;
    }
    else if(a[i].at(0)=='H'){
      h++;
    }
  }
    long long int ans;
    ans=m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h;
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:19: error: conflicting declaration 'long long int a'
   11 |   long long int m,a,r,c,h;
      |                   ^
a.cc:7:10: note: previous declaration as 'std::string a [n]'
    7 |   string a[n];
      |          ^
a.cc:17:7: error: lvalue required as increment operand
   17 |       a++;
      |       ^
a.cc:30:10: error: invalid operands of types 'long long int' and 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'} to binary 'operator*'
   30 |     ans=m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h;
      |         ~^~
      |         | |
      |         | std::string [n] {aka std::__cxx11::basic_string<char> [n]}
      |         long long int
a.cc:30:16: error: invalid operands of types 'long long int' and 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'} to binary 'operator*'
   30 |     ans=m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h;
      |               ~^~
      |               | |
      |               | std::string [n] {aka std::__cxx11::basic_string<char> [n]}
      |               long long int
a.cc:30:22: error: invalid operands of types 'long long int' and 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'} to binary 'operator*'
   30 |     ans=m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h;
      |                     ~^~
      |                     | |
      |                     | std::string [n] {aka std::__cxx11::basic_string<char> [n]}
      |                     long long int
a.cc:30:46: error: invalid operands of types 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'} and 'long long int' to binary 'operator*'
   30 |     ans=m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h;
      |                                             ~^~
      |                                             | |
      |                                             | long long int
      |                                             std::string [n] {aka std::__cxx11::basic_string<char> [n]}
a.cc:30:52: error: invalid operands of types 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'} and 'long long int' to binary 'operator*'
   30 |     ans=m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h;
      |                                                   ~^~
      |                                                   | |
      |                                                   | long long int
      |                                                   std::string [n] {aka std::__cxx11::basic_string<char> [n]}
a.cc:30:58: error: invalid operands of types 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'} and 'long long int' to binary 'operator*'
   30 |     ans=m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h;
      |                                                         ~^~
      |                                                         | |
      |                                                         | long long int
      |                                                         std::string [n] {aka std::__cxx11::basic_string<char> [n]}