Task: | Kasihymiö |
Sender: | Epe |
Submission time: | 2018-01-14 22:33:21 +0200 |
Language: | C++ |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:10:33: error: expected primary-expression before '=' token for (int i = s.length()-1; i > =0; i--){ ^
Code
#include <iostream> #include <cstring> #include <string> using namespace std; int main(){ int c = 0; int p = 0; string s; cin >> s; for (int i = s.length()-1; i > =0; i--){ if(s.substr(i, 1).compare(")") == 0){ p = p + 1; } else { c = c + p; } } cout << c << endl; }