#!/usr/bin/env perl

  use v5.010.000;
  use warnings;
  use strict;

#  say "Hello World!";

#  print $ARGV[ 1 ];


while ( my $line = <> )
{
  if ( $line =~ m/^(\w*)\s+FCC\s+(\d+),(.*)$/ )
  {
    my $label = $1;
    my $symlength = $2;
    my $strfield = $3;
    my $symbol = substr( $strfield, 0, $symlength );
    my $leftovers = substr( $strfield, $symlength );
    my $strlength = length( $symbol );
    if ( $strlength < $symlength )
    {
      print "$label\tFCC error\t'$symbol' not complete to "
            . "$symlength characters (only $strlength). ****error***";
    }
    else
    {
      my $fullsymbol = $symbol;
      if ( $leftovers =~ m/^(\S+)(.*)$/ )
      {
        $fullsymbol .= $1;
        $leftovers = $2;
      }
      print "$label\tFCC\t'$symbol'\t; '$fullsymbol'";
    }
    
    if ( length( $leftovers ) > 0 )
    {
      print " : $leftovers";
    }
    print "\n";
  }
  else
  {
    print $line;
  }
}

