Created
October 6, 2018 14:30
-
-
Save JeffIrwin/3b519cda2c1e1771b2203caa77a412cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subroutine eniuq(t) | |
character(len = :), allocatable :: s | |
character(len = *) :: t | |
integer :: i | |
s = '' | |
do i = 1, len(t) | |
if (t(i:i) == char(10)) then | |
s = s//char(34)//'//char(10)// &'//t(i:i)//' '//char(34) | |
else | |
s = s//t(i:i) | |
end if | |
end do | |
print '(a)', t//'('//char(34)//s//char(34)//')'//char(10)//'end program p' | |
end subroutine eniuq | |
program p | |
call eniuq("subroutine eniuq(t)"//char(10)// & | |
" character(len = :), allocatable :: s"//char(10)// & | |
" character(len = *) :: t"//char(10)// & | |
" integer :: i"//char(10)// & | |
" s = ''"//char(10)// & | |
" do i = 1, len(t)"//char(10)// & | |
" if (t(i:i) == char(10)) then"//char(10)// & | |
" s = s//char(34)//'//char(10)// &'//t(i:i)//' '//char(34)"//char(10)// & | |
" else"//char(10)// & | |
" s = s//t(i:i)"//char(10)// & | |
" end if"//char(10)// & | |
" end do"//char(10)// & | |
" print '(a)', t//'('//char(34)//s//char(34)//')'//char(10)//'end program p'"//char(10)// & | |
"end subroutine eniuq"//char(10)// & | |
char(10)// & | |
"program p"//char(10)// & | |
" call eniuq") | |
end program p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment