Answer the question
In order to leave comments, you need to log in
How to complete this code?
#include <iostream>
#include <vector>
using namespace std;
int main(){
string a;
cin>>a;
int c;
vector<char> b;
for(int i = 0; i < a.length(); i++){
if(a[i] == '(') b.push_back(a[i]);
else if(a[i] == ')') b.pop_back();
}
if(b.size() > 0) cout<<"Неправильная скобочная последовательность!!!"<<endl;
else cout<<"Правильная скобочная последовательность"<<endl;
}
Answer the question
In order to leave comments, you need to log in
Because you are doing pop_back on an empty vector.
/([^\d.-]|(?<=\.\d\d).+)/g
https://regex101.com/r/Ypju79/1
Upd:
Hmm. It turned out that there is no positive lookbehind in js.
In any case, it will not be possible to do this with the help of one regular expression of adequate size.
It's easier to do post processing in js. Here is an example:
codepen.io/anon/pen/QGrYrw
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question