Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char text[255];
- char result[255];
- cin.getline(text, 255);
- int open = -1;
- int close = -1;
- int size = 0;
- for (int i = 0; text[i] != '\0'; i++)
- {
- if (open == -1)
- {
- if (text[i] == '(')
- open = i;
- else
- {
- result[i] = text[i];
- size++;
- }
- }
- else if (text[i] == ')')
- close = i;
- else if (close != -1)
- {
- result[i - open - 2] = text[i];
- size++;
- }
- }
- result[size] = '\0';
- std::cout << result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement