A deferred-length allocatable character(len=:) auto-resizes on assignment, perfect for building strings.

Program

Play the program to concatenate two parts with a space.

string_concat.f90
program string_concat
    implicit none
    character(len=:), allocatable :: first, last, full
    first = "Modern"
    last = "Fortran"
    full = first // " " // last
    print '(A)', full
end program string_concat
deferred length `character(len=:), allocatable` sizes the string on assign.
// concat `a // b` joins two strings end-to-end.
auto-allocate Assignment to an unallocated deferred-length string allocates the right length.