! Program Example from "Essential Fortran 90 & 95" by Loren P. Meissner
! Copyright 1996. Copying for sale requires permission from the author.
! Otherwise, distribution is permitted if these three lines are included.

! Example 6.13. Concatenation of character expressions.
  program G13
    implicit none
    integer, parameter :: LFS = 6, LL = 9, LS = 2, LAX = 14
    character (len = LFS) :: First, Second
    character (len = LL) :: Longer
    character (len = LS) :: Small
    character (len = LAX) :: A, X
! start program G13
    First = "Hello."
    Longer = First // " z "  ! Longer = "Hello. z "
    A = Longer(1: 7) // Longer(1: 7)  ! Longer(1: 7) = "Hello. "
    write (unit = *, fmt = *) Longer
    write (unit = *, fmt = *) A, ":"
    Small = "  "
    Second = "there."
    X = Small // First(: 5) // " " // Second  ! X = "  Hello there."
    write (unit = *, fmt = *) X
    write (unit = *, fmt = *) " Because it's " // Second
    stop
  end program G13
