From 335258ac032914bd27491df4cd2a21fb29205ec5 Mon Sep 17 00:00:00 2001 From: Dhaval Pandey <68287498+dhavalpandey@users.noreply.github.com> Date: Mon, 30 Oct 2023 19:59:35 +0000 Subject: [PATCH] Create SolutionByDhaval.py --- .../Longest Common Prefix/SolutionByDhaval.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Divide and Conquer/Longest Common Prefix/SolutionByDhaval.py diff --git a/Divide and Conquer/Longest Common Prefix/SolutionByDhaval.py b/Divide and Conquer/Longest Common Prefix/SolutionByDhaval.py new file mode 100644 index 000000000..9166244d7 --- /dev/null +++ b/Divide and Conquer/Longest Common Prefix/SolutionByDhaval.py @@ -0,0 +1,13 @@ +import os + +list_input = input()[1:] +list_input = list_input[:-1] + +list_input = list_input.replace("”", "") +list_input = list_input.replace("“", "") +list_input = list_input.replace('"', '') +list_input = list_input.replace(" ", "") + +list = list(map(str, list_input.split(","))) + +print(os.path.commonprefix(list))