This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set1, set2 = ["cbaebabacd", "fish", "abab", "sdsfs", ""], ["abc", "cake", "ab", "", "a"] | |
for s1, s2 in zip(set1, set2): # Running loop over all test cases | |
mp1 = {ord('a')+i:0 for i in range(26)} # Creating a dict for all 26 chars | |
res = [] # Result set | |
for i in range(len(s2)): | |
mp1[ord(s2[i])] += 1 # Incrementing the frequency of each character in string 2 | |
for i in range(0, len(s1)-len(s2)+1): # Outer loop for all window of length s2 over s1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n=int(input()) | |
m=int(input()) | |
if m>n: | |
n,m=m,n | |
i=1 | |
while m!=0: | |
print("Number of Square(s) of type ",i,"x",i," : ",n*m) | |
n,m,i=n-1,m-1,i+1 |