fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main() {
  6. int a,b=0,c;
  7. cin>>c;
  8. cout<<c<<endl;
  9. do{
  10. cin>>a;
  11.  
  12. cout<<a<<endl;
  13. if(a==42&&c!=42)b+=1;
  14. c = a;
  15. }while(b!=3);
  16.  
  17. }
Success #stdin #stdout 0s 5284KB
stdin
42
42
12
13
42
11
42
43
42
42
99
01
stdout
42
42
12
13
42
11
42
43
42