aboutsummaryrefslogtreecommitdiff
path: root/challenge-255/eric-cheung/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-255/eric-cheung/python/ch-1.py')
-rwxr-xr-xchallenge-255/eric-cheung/python/ch-1.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/challenge-255/eric-cheung/python/ch-1.py b/challenge-255/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..fdd8032691
--- /dev/null
+++ b/challenge-255/eric-cheung/python/ch-1.py
@@ -0,0 +1,29 @@
+
+import sys
+
+## Example 1
+## strInput = "Perl"
+## strCheck = "Preel"
+
+## Example 2
+## strInput = "Weekly"
+## strCheck = "Weeakly"
+
+## Example 3
+strInput = "Box"
+strCheck = "Boxy"
+
+arrUniqCharInput = list(set(strInput))
+arrCharInputCount = [strInput.count(charLoop) for charLoop in arrUniqCharInput]
+
+arrUniqCharCheck = list(set(strCheck))
+arrUniqCheck = [strCheck.count(charLoop) for charLoop in arrUniqCharCheck]
+
+for nIndx, charLoop in enumerate(arrUniqCharCheck):
+ if charLoop not in arrUniqCharInput:
+ print (charLoop)
+ sys.exit()
+
+ if arrUniqCheck[nIndx] > arrCharInputCount[arrUniqCharInput.index(charLoop)]:
+ print (charLoop)
+ sys.exit()