 Generer programme oyo ekoki koluka pallindrome ya molayi na chaîne moko donnée
Tala programme ya Python pona koluka palindrome ya molayi na chaîne oyo epesami: ```python def longest_palindrome(string): max_length = 1 ebandeli = 0 longueur = len(string) low = 0 haut = 0 pona i na range(1, bolai): # Luka palindrome ya bolai ata oyo eleki molai na ba points ya centre lokola i-1 na i. nse = i - 1 likolo = i nzokande nse >= 0 mpe likolo < bolai mpe molongo[nse] == molongo[likolo]: soki likolo - na nse + 1 > max_length: kobanda = nse max_length = likolo - nse + 1 nse - = 1 likolo += 1 # Luka palindrome ya bolayi impair ya molayi na point ya centre lokola i na se = i - 1 likolo = i + 1 alors que na se >= 0 pe likolo < longueur na molongo[nse] == molongo[likolo]: soki likolo - na nse + 1 > max_length: kobanda = moke max_length = likolo - na nse + 1 na nse -= 1 likolo += 1 zongisa molongo[kobanda:kobanda + max_length] # Meka molongo ya code = "ababad" résultat = longest_palindrome(string) print(f"Molongo ya moke ya palindrome ya molai na molongo epesami '{string}' ezali '{result}'.") ``` Bobimisi: ``` Molongo ya moke ya palindrome ya molai na molongo epesami 'ababad' ezali 'ababa'. ```