program main
implicit none
character*20 str
integer i
print*,'input the string:'
read*,str
do i=1,len_trim(str)
if(str(i:i)>='a'.and.str(i:i)<='z') str(i:i)=char(ichar(str(i:i))-32)
end do
print*,’the inverted string:’
print*,str
end
按shift和Caps Lock就行了