CSES - Datatähti 2021 alku - Results
Submission details
Task:Sanalista
Sender:iiraj
Submission time:2020-09-28 22:07:07 +0300
Language:C++11
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:12:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < x.length(); i++) {
                         ~~^~~~~~~~~~~~
input/code.cpp:15:18: error: 'count' was not declared in this scope
             if ((count(x.begin(), x.end(), c) % 2) == 0) {
                  ^~~~~

Code

#include <iostream>
#include <string>
using namespace std;
int main()
{
    int o;
    int n;
    cin >> n;
    string x;
    while (cin >> x) {
        bool t = true;
        for (int i = 0; i < x.length(); i++) {
            char c = x[i];

            if ((count(x.begin(), x.end(), c) % 2) == 0) {
                continue;
            }
            else {
                t = false;
                break;
            }
        }
        if (t) {
            o++;
        }
    }
    cout << o;
}