// Version 3 - Process Creation with Switch
#include <stdio.h>
#include <unistd.h>
int main() {
switch(fork()) {
case 0:
if(fork())
fork();
break;
default:
if(fork() == 0) {
fork();
} else {
if(fork() == 0)
}
}
return 0;
}
Ly8gVmVyc2lvbiAzIC0gUHJvY2VzcyBDcmVhdGlvbiB3aXRoIFN3aXRjaAojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHVuaXN0ZC5oPgoKaW50IG1haW4oKSB7CiAgICBwcmludGYoImhlbGxvXG4iKTsKICAgIHN3aXRjaChmb3JrKCkpIHsKICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgIHByaW50ZigiaGVsbG9cbiIpOwogICAgICAgICAgICBpZihmb3JrKCkpCiAgICAgICAgICAgICAgICBmb3JrKCk7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgIGlmKGZvcmsoKSA9PSAwKSB7CiAgICAgICAgICAgICAgICBwcmludGYoImhlbGxvXG4iKTsKICAgICAgICAgICAgICAgIGZvcmsoKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHByaW50ZigiaGVsbG9cbiIpOwogICAgICAgICAgICAgICAgaWYoZm9yaygpID09IDApCiAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCJoZWxsb1xuIik7CiAgICAgICAgICAgIH0KICAgIH0KICAgIHByaW50ZigiaGVsbG9cbiIpOwogICAgcmV0dXJuIDA7Cn0=