fork(2) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int tab[10] = {};
  8. int ile = 0;
  9. char sign;
  10. while( cin >> sign ){
  11. if (sign == '-'){
  12. if(ile == 0 || ile > 10){
  13. cout << ":(" << endl;
  14. }
  15. else{
  16. ile--;
  17. cout << tab[ile];
  18. }
  19.  
  20. }
  21. else {
  22. cin >> tab[ile];
  23. if( ile > 9){
  24. cout << ":("<<endl;
  25. }
  26. else {
  27. cout << ":)" << endl;
  28. if( ile < 10 ) ile++;
  29.  
  30. }
  31.  
  32.  
  33. }
  34. }
  35.  
  36.  
  37.  
  38. return 0;
  39. }
  40.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty