We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 307a0bb commit a64f047Copy full SHA for a64f047
1 file changed
Fractal_Analytics/countOfAnagrams.py
@@ -2,4 +2,19 @@
2
Given a text and a word, find the count of occurrences of anagrams
3
of word in given text
4
5
-"""
+"""
6
+
7
+def countAnagrams(text,word):
8
+ count=0
9
+ b = text
10
+ a = word
11
+ for i in range(len(b)-len(a)+1):
12
+ if(sorted(a)==sorted(b[i:i+len(a)])):
13
+ count=count+1
14
+ return count
15
16
17
+if __name__ == '__main__':
18
+ text = str(input())
19
+ word = str(input())
20
+ print (countAnagrams(text, word))
0 commit comments