Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <cctype>
- using namespace std;
- int main() {
- char S[100000] = {};
- cin.getline(S, 100000);
- int size = strlen(S), count = 0;
- bool eyes, mouth;
- for (int i = 0; i < size;) {
- eyes = false;
- mouth = false;
- if (S[i] == ';' || S[i] == ':') {
- eyes = true;
- ++i;
- if (S[i] == '-') {
- while (S[i] == '-') {
- ++i;
- }
- if (S[i] == ')' || S[i] == '(' || S[i] == ']' || S[i] == '[') {
- mouth = true;
- while (S[i] == ')' || S[i] == '(' || S[i] == ']' || S[i] == '[') {
- ++i;
- }
- }
- }
- else {
- if (S[i] == ')' || S[i] == '(' || S[i] == ']' || S[i] == '[') {
- mouth = true;
- while (S[i] == ')' || S[i] == '(' || S[i] == ']' || S[i] == '[') {
- ++i;
- }
- }
- }
- }
- else {
- ++i;
- }
- if (eyes && mouth)
- ++count;
- }
- cout << count;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment