Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool Parenteritzat(string s) {
- PilaChar t;
- for(int i = 0; i < s.length();i++)
- {
- switch(s[i])
- {
- case '{':
- case '(':
- case '[':
- t.empila(s[i]);
- break;
- case '}':
- if (t.cim() == '{')t.desempila();
- else return false;
- break;
- case ')':
- if (t.cim() == '(')t.desempila();
- else return false;
- break;
- case ']':
- if (t.cim() == '[')t.desempila();
- else return false;
- break;
- default:
- break;
- }
- }
- return t.buida();
- }
- int main() {
- string lmao;
- cin >> lmao;
- cout << (Parenteritzat(lmao) ? "Ok" : "Mec");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement