UVa 325 - Identifying Legal Pascal Real Constants

Summary
Determine whether a line of text follows the Pascal standard's definition of a constant numeral.

Gotcha's

 * Be mindful of spacing.

Input
k s jhsfdkkjsa df  sadf s dsfgh sdf gk dsf

2 2 3443 457 65 2e3e2e2 +e-2 +2-1 +2e-2 +2e+2 2 e2 -2e-1-1 442 3465374657846358634563865923569548236458263458623562835682346582364582364 34653746578463 5863456386592356 95482364582634586235 62835682346582364582364 45643856 4353 e 546456 456456e345345 462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576 462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576+ 462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576- +462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576 462976592798713405193549823645926395628346589236458946e+4569223458726348563256238465872465876324576 -462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576 462976592798713405193549823645926395628346589236458946e-4569223458726348563256238465872465876324576 +462976592798713405193549823645926395628346589236458946e-4569223458726348563256238465872465876324576 -462976592798713405193549823645926395628346589236458946e+4569223458726348563256238465872465876324576 12e21 435e231e123e213 23e+355-14 +234+e234+E1234 3.2 459679346834596734956739476984396739476972394571936459823645863195629384658723653245235.37563286583645162847686587436587632475 457693476987495864364.5645634564564356e4563564564356543 457693476987495864364.5645634564564356e+4563564564356543 457693476987495864364.5645634564564356e-4563564564356543 +457693476987495864364.5645634564564356e4563564564356543 -457693476987495864364.5645634564564356e4563564564356543 457693476987495864364.+5645634564564356e4563564564356543 457693476987495864364.-5645634564564356e4563564564356543
 * 2

Output
k s jhsfdkkjsa df  sadf s is illegal. dsfgh sdf gk dsf is illegal. is illegal. 2 2 3443 457 65 is illegal. 2e3e2e2 is illegal. +e-2 is illegal. +2-1 is illegal. +2e-2 is legal. +2e+2 is legal. 2 e2 is illegal. -2e-1-1 is illegal. 442 is illegal. 3465374657846358634563865923569548236458263458623562835682346582364582364 is illegal. 34653746578463 5863456386592356 95482364582634586235 62835682346582364582364 is illegal. 45643856 is illegal. 4353 e 546456 is illegal. 456456e345345 is legal. 462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576 is legal. 462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576+ is illegal. 462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576- is illegal. +462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576 is legal. 462976592798713405193549823645926395628346589236458946e+4569223458726348563256238465872465876324576 is legal. -462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576 is legal. 462976592798713405193549823645926395628346589236458946e-4569223458726348563256238465872465876324576 is legal. +462976592798713405193549823645926395628346589236458946e-4569223458726348563256238465872465876324576 is legal. -462976592798713405193549823645926395628346589236458946e+4569223458726348563256238465872465876324576 is legal. 12e21 is legal. 435e231e123e213 is illegal. 23e+355-14 is illegal. +234+e234+E1234 is illegal. 3.2 is legal. 459679346834596734956739476984396739476972394571936459823645863195629384658723653245235.37563286583645162847686587436587632475 is legal. 457693476987495864364.5645634564564356e4563564564356543 is legal. 457693476987495864364.5645634564564356e+4563564564356543 is legal. 457693476987495864364.5645634564564356e-4563564564356543 is legal. +457693476987495864364.5645634564564356e4563564564356543 is legal. -457693476987495864364.5645634564564356e4563564564356543 is legal. 457693476987495864364.+5645634564564356e4563564564356543 is illegal. 457693476987495864364.-5645634564564356e4563564564356543 is illegal.
 * 2 is illegal.