start(1). delta(1, h, 2). delta(2, a, 3). delta(3, h, 2). delta(3, !, 4). final(4). accept([], State) :- final(State). accept([Char|Chars], State) :- delta(State, Char, NextState), accept(Chars, NextState). eingabe(String) :- start(StartState), accept(String, StartState).