From 1e052ae8a6b5c52355fa97e58aa96fa2f20bd9f0 Mon Sep 17 00:00:00 2001 From: mohammed <71840574+mohamd-apas@users.noreply.github.com> Date: Fri, 1 Oct 2021 17:32:02 +0300 Subject: [PATCH] mohammd apas --- python-pass.py | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/python-pass.py b/python-pass.py index dbf8e87..150969f 100644 --- a/python-pass.py +++ b/python-pass.py @@ -1,7 +1,29 @@ +def find(s): + + string_word = "" + max_repeat = s[0]; + -class Solution: + length= len(s) - @staticmethod - def longest_palindromic(s: str) -> str: - pass + for i in s: + num = s.count(i) + + if s.count(max_repeat) < num: + max_repeat = i + + + for i in range(length): + if(s[i] == max_repeat): + for j in range(i,length): + + if(string_word.count(max_repeat) < s.count(max_repeat)): + + string_word += s[j] + print(string_word.count(max_repeat)) + + print("the longest Palindromic = ",string_word) + +x = input("enter the string: ") +find(x)