Serial Monitor isn't displaying entire print

I'm building a PWM generator on an UNO r3 as part of a larger project and I'm fairly new to arduino. Currently I'm just trying to test my code but I'm finding that the Serial Monitor stops sending prints very shortly after launching. I checked around and tried to stop the serial from resetting by dropping a resistor between the 5v and reset, a capacitor from 5v to gnd, and from 5v to reset. None of those seemed to help. I also added in 'while (!Serial)' if anyone has any suggestions I'd appreciate it.

The print on the serial monitor only shows:
"Enter Heating Number 0 to 9, followed by a comma
then a four digit time in seconds (012"

int pwmPin = 9;    // pwm connected to digital pin 9
int PWMvalue = 0;

void setup() {
  //allows serial communication at 9600 baud
  Serial.begin(9600);
  while (!Serial); // Wait until Serial is communicating
   Serial.println("Enter Heating Number 0 to 9, followed by a comma");
   Serial.println("then a four digit time in seconds (0120 would be two minutes),");
   Serial.println("or simply 'x' to power off");
}

void loop() {
  if (Serial.available() > 0){
   String in = {Serial.readString()};
   int pwr = in[0];
   int t = {(in[5] * 1000) + (in[4] * 100) + (in[3] * 10) + in[2]};
    if (pwr >= 0 && pwr <= 9)
    {
      PWMvalue = (pwr + 1) * 25;  //255=100%, 127=50%, ect
      analogWrite(pwmPin, PWMvalue);
      Serial.print("Heating element powered to ");
      Serial.print((pwr + 1) * 10);
      Serial.println("%");
      Serial.println("pwr is currently: ");
      Serial.print(pwr);
      Serial.println("t is currently: ");
      Serial.print(t);
      delay((t - '0') * 1000);
      PWMvalue = 0;
      analogWrite(pwmPin, PWMvalue);
      Serial.println("Heating is complete, exiting Program in 10 seconds");
      delay(10000);
      Serial.println("Goodbye");
      exit(0);
    }
    if (pwr == 'x')
    {
      PWMvalue = 0;
      analogWrite(pwmPin, PWMvalue);
      Serial.println("Heating element powered off, exiting Program in 10 seconds");
      delay(10000);
      Serial.println("Goodbye");
      exit(0);
    }
    else
    {
      PWMvalue = 0;
      analogWrite(pwmPin, PWMvalue);
      Serial.println("ERROR: Invalid  Input");
      Serial.println("Exiting Program in 10 seconds");
      delay(10000);
      Serial.println("Goodbye");
      exit(0);
    }
  }
    PWMvalue = 0;
    analogWrite(pwmPin, PWMvalue);
    Serial.println("Goodbye");
    exit(0);
}

The problem is that when the line:

exit(0);

is reached it kills the program execution. I takes some time for the serial prints to go out, which makes it appear that it's halting in setup() when the program has actually progressed beyond there. If you add a delay statement after the serial prints you will see the full text. This is a serious problem of using Serial.print() for debug output.

There's really no good reason to use exit() in an Arduino program because you have nowhere to exit to. If you want to permanently halt program execution you can use an infinite loop:

while(true) {}

What are the exit() calls for?
The Arduino runtime environment doesn’t exit to anything (like Windows etc)

If you want to return from a function, you can just use ‘return’, but there is no departure posible from loop()

In some cases, you could use break, but the way your if()s are structured, that won’t do anything either.

Back to the book on program flow control i’m afraid.