Created
November 11, 2016 14:05
-
-
Save Rushi98/bb7c320ca25ed8daf5a37e6749f8a6c6 to your computer and use it in GitHub Desktop.
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
T = int(raw_input()) | |
for __ in range(T): | |
tmp = str(raw_input()) | |
c = 0 | |
for l in range(1,len(tmp)): | |
a = [] | |
for i in range(len(tmp) - l + 1): | |
a.append(tmp[i:i+l]) | |
for i in range(len(a)): | |
for j in range(i + 1, len(a)): | |
if sorted(list(a[i])) == sorted(list(a[j])) :c += 1 | |
print c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment