From 6703a48b4be10d9dcd2242b7da1e9b69b213af3b Mon Sep 17 00:00:00 2001 From: intel Date: Fri, 22 Oct 2021 20:28:47 +0530 Subject: [PATCH] added an python file with an algo which find first non repeating element in string --- findFirstNonRepeatingInString.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 findFirstNonRepeatingInString.py diff --git a/findFirstNonRepeatingInString.py b/findFirstNonRepeatingInString.py new file mode 100644 index 0000000..ad09dab --- /dev/null +++ b/findFirstNonRepeatingInString.py @@ -0,0 +1,6 @@ +s = input("enter string: ") +dict1 = {} +for i in s: + dict1[i] = dict1.get(i, 0) + 1 + +print(dict1)