Task: | Sanalista |
Sender: | AleksandrPolitov |
Submission time: | 2020-10-05 10:57:44 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | ACCEPTED | 0.01 s | details |
Compiler report
input/code.cpp: In function 'void solve(std::__cxx11::string)': input/code.cpp:12:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < word.size(); i++) ~~^~~~~~~~~~~~~
Code
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int r = 0; void solve(string word) { vector<char> v; for (int i = 0; i < word.size(); i++) { auto f = find(v.begin(), v.end(), word[i]); if (f != v.end()) { v.erase(v.begin() + distance(v.begin(), f)); } else { v.push_back(word[i]); } /*for (int i = 0; i < v.size(); i++) cout << v[i] << ":"; cout << endl;*/ } //cout << v.size(); if (v.size() == 0) r++; } //5 //huuliharppu //kirppusirkus //oskilloskooppi //papukaija //tieteellinen int main() { int c; string word; cin >> c; for (int i = 0; i < c; i++) { cin >> word; if (word.length() % 2 == 0) solve(word); } cout << r; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1000 korvata sopimusaika nuhatartunta korttiautomaatti ... |
correct output |
---|
15 |
user output |
---|
15 |
Test 2
Verdict: ACCEPTED
input |
---|
1000 pub hansikaslokero erikoisvalmisteinen unijukka ... |
correct output |
---|
42 |
user output |
---|
42 |
Test 3
Verdict: ACCEPTED
input |
---|
1000 haapalastu toipumisaika mustalaiskieli taidelainaamo ... |
correct output |
---|
70 |
user output |
---|
70 |