It seems the input has the following format:
N
X ]
X X ] pyramid height
X X X]
^---^ pyramid width
In this case, N=3, T=6
The way I would normally do this is to just read it and check if the input is valid. But in this case the input contains a leading integer N that tells you the size of the 'pyramid' that follows. You might as well use that rather than rely on whitespace to determine where in the character sequence N and the Xs are. Or where one pyramid ends and the other begins. Never rely on whitespace, kids!
I would scan for N and from that determine the total number of elements T in the pyramid. I would then try to read that many numbers, ignoring all whitespace except for using them as separators between the numbers. You can try to keep reading Ns as long as possible, because a successful N read means a pyramid will follow (as long as the input is correct).
Failure to read a number might be because of invalid input or because of reaching the end-of-file. Check the documentation of the I/O facilities of your language.
I always wrote small programs like this to always exit on any input error. It's safe to assume in programming challenges that input errors mean end-of-file and not invalid input.
As this sounds like an extremely familiar coding challenge to me, so I leave the actual coding and finding the appropriate functions to use as an exercise for the reader.