You can clear the input stream:

while(getchar() != '\n') {};

Or just use readln:

int resp = readln.chomp.to!int;

Reply via email to