I received a task to write a Prolog program which can list all of those 'substrings' of a 'string', whose end with an 'a' character and length is at least two character.
For example:
?- avegu("baka", R).
R = "ba";
R = "baka";
R = "aka";
R = "ka";
false.
My idea is that I should split the given character list (string) to [Head|Tail] and call it recursively. When Head is 'a', returns the substring which I iterated over, then continue this until the end of the list. I don't know how to implement this idea.