program main implicit none integer::N character*102400::str do read (*,'(a)',advance='yes'),str if(str(1:1).eq." ") exit if(check(str).eqv..true.) then print '(a)', "CORRECT (maybe)" else print '(a)', "WRONG!" end if end do contains logical function check(str) result(l) integer::i character*7::strend character*102400::str l = .false. if(str(1:5).eq."rabi ") then do i=6,LEN(str) if((ICHAR(str(i:i)).ge.ICHAR('a').and. & ICHAR(str(i:i)).le.ICHAR('z')).or. & (ICHAR(str(i:i)).ge.ICHAR('A').and. & ICHAR(str(i:i)).le.ICHAR('Z')).or. & (ICHAR(str(i:i)).ge.ICHAR('0').and. & ICHAR(str(i:i)).le.ICHAR('9'))) then l = .true. return end if end do end if if(LEN(str).lt.7) return call get_capital_str(str,strend) if(str(1:5).eq."digi ") then do i=2,5 if(strend(i:i+2).eq."NYO") then l = .true. exit end if end do else if(str(1:5).eq."petit ") then do i=2,5 if(strend(i:i+2).eq."NYU") then l = .true. exit end if end do else if(str(1:5).eq."gema ") then do i=1,4 if(strend(i:i+3).eq."GEMA") then l = .true. exit end if end do else if(str(1:5).eq."piyo ") then do i=2,5 if(strend(i:i+2).eq."PYO") then l = .true. exit end if end do end if end function check character function get_capital(c) result(cc) character::c if(ICHAR(c).ge.ICHAR('a').and.ICHAR(c).le.ICHAR('z')) then cc = CHAR(ICHAR(c)-ICHAR('a')+ICHAR('A')) else cc = c end if end function get_capital subroutine get_capital_str(str, strend) integer::i character*7::strend character*102400::str do i=1,7 strend(i:i) = get_capital(str(i+LEN_TRIM(str)-7:i+LEN_TRIM(str)-7)) end do end subroutine get_capital_str end program main