fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int N = 200;
  5.  
  6. void revers(char * res, int &n) {
  7. char a;
  8. cin >> a;
  9. if (a == ')') return;
  10. else revers(res, n);
  11. res[n++] = a;
  12. }
  13.  
  14. int main() {
  15. char res[N];
  16. char a;
  17. int n = 0;
  18. while (cin >> a) {
  19. if (a == '(') revers(res, n);
  20. else res[n++] = a;
  21. }
  22. for (int i = 0; i < n; i++)
  23. cout << res[i];
  24. return 0;
  25. }
Success #stdin #stdout 0s 15232KB
stdin
	russ(ai)(edocn)cup
stdout
russiancodecup