From a9bc8c203044a53e45220e4560d243ef8e7f40de Mon Sep 17 00:00:00 2001
From: Kreetisingh <kreeti.singh@justpay.in>
Date: Wed, 30 Sep 2020 18:55:04 +0530
Subject: [PATCH] Added a dictionary folder and placed two python programs
 inside that

---
 Dictionary/checkStrings.py   | 47 ++++++++++++++++++++++++++++++++++++
 Dictionary/frequencyCount.py | 21 ++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 Dictionary/checkStrings.py
 create mode 100644 Dictionary/frequencyCount.py

diff --git a/Dictionary/checkStrings.py b/Dictionary/checkStrings.py
new file mode 100644
index 0000000..4c85ea2
--- /dev/null
+++ b/Dictionary/checkStrings.py
@@ -0,0 +1,47 @@
+#  A program to check whether the string contains equal & same no of characters
+import collections
+
+
+def check_strings(word1, word2):
+    word1 = list(word1)
+    word2 = list(word2)
+    dict1 = {}
+    dict2 = {}
+    flag = True
+    for i in word1:
+        if i in dict1:
+            dict1[i] = dict1[i] + 1
+            continue
+        else:
+            dict1[i] = 1
+    for i in word2:
+        if i in dict2:
+            dict2[i] = dict2[i] + 1
+            continue
+        else:
+            dict2[i] = 1
+    if len(dict1) == len(dict2):
+        for k, v in dict1.items():
+            if k in dict2:
+                if dict2[k] == v:
+                    continue
+                else:
+                    flag = False
+                    break
+            else:
+                flag = False
+                break
+    if flag:
+        print("Same")
+    else:
+        print("Not Same")
+
+
+def main():
+    word1 = input("Enter first string : ")
+    word2 = input("Enter second string : ")
+    check_strings(word1, word2)
+    word = "madam"
+
+
+main()
diff --git a/Dictionary/frequencyCount.py b/Dictionary/frequencyCount.py
new file mode 100644
index 0000000..7bd8f4a
--- /dev/null
+++ b/Dictionary/frequencyCount.py
@@ -0,0 +1,21 @@
+# A python program to calculate the frequency of each character in the string
+def count_frquency(word):
+    val=dict()
+    word=list(word)
+    for i in word:
+        if i in val:
+            val[i]=val[i]+1
+            continue
+        else:
+            val[i]=1
+    print(word)
+    return val
+
+
+def main():
+    word=input("Enter a string whose frequency you want to calculate ")
+    print(word)
+    print("Frequency of respective characters in {0} is {1}".format(word,count_frquency(word)))
+
+main()
+