Reverse String in Fortran

Published on 27 October 2020 (Updated: 19 March 2023)

Welcome to the Reverse String in Fortran page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

program reversestring
character(len=100) :: argument
character(len=:), allocatable :: buff, reversed
integer :: i, n
call GET_COMMAND_ARGUMENT(1,argument)
allocate (buff, mold=argument)
n = len(argument)
do i = 0, n - 1
    buff(n-i : n-i) = argument(i+1 : i+1)
end do
reversed = adjustl(trim(buff))
write(*,'(g0.8)')reversed
end program reversestring

Reverse String in Fortran was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.