From 42d05c8a3f59f99daccaf65a117d183828446d71 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Thu, 29 Sep 2022 09:56:15 +0200 Subject: Test the longest tail --- mendeleev.f90 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'mendeleev.f90') diff --git a/mendeleev.f90 b/mendeleev.f90 index c7df836..5abe2a4 100644 --- a/mendeleev.f90 +++ b/mendeleev.f90 @@ -171,23 +171,19 @@ contains character(len=*), intent(in) :: word type(formula_t), pointer :: formula - logical :: has_tail type(formula_t), pointer :: f allocate(formula) allocate(formula%elements(len(word))) - do + do while (formula%tail <= len(word)) f => formula - has_tail = .false. do while (associated(f)) if (f%tail <= len(word)) then call advance(word, f) - if (.not. has_tail) has_tail = f%tail <= len(word) end if f => f%next end do - if (.not. has_tail) exit end do end function explode end program mendeleev -- cgit v1.2.3