aboutsummaryrefslogtreecommitdiff
path: root/challenge-321/eric-cheung/python/ch-2.py
diff options
context:
space:
mode:
authorDave Jacoby <jacoby.david@gmail.com>2025-05-15 16:45:20 -0400
committerGitHub <noreply@github.com>2025-05-15 16:45:20 -0400
commitefc2a652edb6436965e12883bedf035ea081284d (patch)
tree7e9940d4f72fe1e8d984b3746af2d30dff96330b /challenge-321/eric-cheung/python/ch-2.py
parent6886bd3e06ccf8b0a564f3c434cd53131d126f70 (diff)
parented7588dadb77d63adca3d3aefc6cd325164e0947 (diff)
downloadperlweeklychallenge-club-efc2a652edb6436965e12883bedf035ea081284d.tar.gz
perlweeklychallenge-club-efc2a652edb6436965e12883bedf035ea081284d.tar.bz2
perlweeklychallenge-club-efc2a652edb6436965e12883bedf035ea081284d.zip
Merge branch 'manwar:master' into master
Diffstat (limited to 'challenge-321/eric-cheung/python/ch-2.py')
-rwxr-xr-xchallenge-321/eric-cheung/python/ch-2.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/challenge-321/eric-cheung/python/ch-2.py b/challenge-321/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..092cd5378f
--- /dev/null
+++ b/challenge-321/eric-cheung/python/ch-2.py
@@ -0,0 +1,29 @@
+
+def GetRefineStr (strInput):
+ arrTemp = list(strInput)
+ while "#" in arrTemp:
+ nPosBackSpace = arrTemp.index("#")
+ arrTemp.pop(nPosBackSpace)
+ arrTemp.pop(nPosBackSpace - 1)
+
+ return "".join(arrTemp)
+
+## Example 1
+## strInput_01 = "ab#c"
+## strInput_02 = "ad#c"
+
+## Example 2
+## strInput_01 = "ab##"
+## strInput_02 = "a#b#"
+
+## Example 3
+strInput_01 = "a#b"
+strInput_02 = "c"
+
+strInput_01_rev = GetRefineStr(strInput_01)
+strInput_02_rev = GetRefineStr(strInput_02)
+
+## print (strInput_01_rev)
+## print (strInput_02_rev)
+
+print (strInput_01_rev == strInput_02_rev)