Language: C++

    #include <bits/stdc++.h>
                using namespace std;
                 
                int main() {
                  int N, p, y , w, g, i, sum;
                  
                  cin >> N;
                  cout << endl;
                  string x;
                  
                  for(i = 0; i < N; i++){
                    cin >> x;
                  if (x[i] == "P"){
                    p = 1;
                  }else if (x[i] == "Y"){
                    y = 1;
                  }else if (x[i] == "W"){
                    w = 1;
                  }else if (x[i] == "G"){
                    g = 1;
                  }
                  }
                  sum = p + y + w + g;
                  if(sum == 3){
                    cout << sum << endl;
                  } else if (sum == 4 ){
                    cout << sum << endl;
                  }
                  
                }

            #include <bits/stdc++.h>
            using namespace std;
             
            int main() {
              int N, p, y , w, g, i, sum;
              
              cin >> N;
              cout << endl;
              char x[N]={};

              for(i = 0; i < N; i++){
                cin >> x;
              if (x[i] == "P"){
                p = 1;
              }else if (x[i] == "Y"){
                y = 1;
              }else if (x[i] == "W"){
                w = 1;
              }else if (x[i] == "G"){
                g = 1;
              }
              }
              sum = p + y + w + g;
              if(sum == 3){
                cout << sum << endl;
              } else if (sum == 4 ){
                cout << sum << endl;
              }
              
            }

提出情報
提出日時

Compiler output:
a.cc: In function 'int main()':
a.cc:13:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 |                   if (x[i] == "P"){
a.cc:15:34: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |                   }else if (x[i] == "Y"){
a.cc:17:34: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |                   }else if (x[i] == "W"){
a.cc:19:34: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   19 |                   }else if (x[i] == "G"){
a.cc: At global scope:
a.cc:35:17: error: redefinition of 'int main()'
   35 |             int main() {
      |                 ^~~~
a.cc:4:21: note: 'int main()' previously defined here
    4 |                 int main() {
      |                     ^~~~
a.cc: In function 'int main()':
a.cc:44:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   44 |               if (x[i] == "P"){
      |                   ~~~~~^~~~~~
a.cc:46:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   46 |               }else if (x[i] == "Y"){
      |                         ~~~~~^~~~~~
a.cc:48:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   48 |               }else if (x[i] == "W"){
      |                         ~~~~~^~~~~~
a.cc:50:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   50 |               }else if (x[i] == "G"){
      |                         ~~~~~^~~~~~
a.cc: At global scope:
a.cc:63:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type
   63 | 提出情報
      | ^~~~~~~~