function perimeter = boundary_word_perimeter ( s )

%*****************************************************************************80
%
%% boundary_word_perimeter(): the perimeter of a polyomino defined by a boundary word.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 May 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    char s(*): a string of the characters 'u', 'd', 'l' and 'r' that should
%    represent a path around the boundary of a polyomino.
%
%  Output:
%
%    integer perimeter: the perimeter of the polyomino define by the boundary word.
%
  check = boundary_word_check ( s );

  if ( ~ check )
    perimeter = -1;
  else
    perimeter = length ( s );
  end

  return
end
