Problem in taking input for the problem-

I can’t be able in taking inputs propely where there are spaces between two strings,& can’t be able to retrieve those integers in C language,if anyone can help pls. suggest something…

I can suggest 2 ways to do this but I am sure that there are many more.
One way is to take the input as 2 strings and then retrieve the node number as:
Consider one of the string was knight1, so you can retrieve the node number as

knight1[1] - '0’

Another way to do this is to take 4 inputs. 2 as characters and 2 as integers. This is what I had done.

char a, b;
int x, y;
cin >> a >> x >> b >> y; // just change this to scanf

Just include <string.h> library and use %s for taking string as input.

I do both the process but the program is showing (runtime error exit code -1073741819).