character*10000::str character::c integer::sum=0 read *,str do i=1,len_trim(str) c = str(i:i) if (c >= '0' .and. c <= '9') then sum = sum + ICHAR(c)-ICHAR('0') end if end do print '(i0)',sum end