Problem Link: https://www.hackerrank.com/challenges/sherlock-and-anagrams
Input Format
First line contains T , the number of testcases. Each testcase consists of string S in one line.
Constraints
1≤T≤10
2≤length(S)≤100
StringS contains only the lowercase letters of the English alphabet.
String
Output Format
For each testcase, print the required answer in one line.
Logic:
Let's say S[i,j] denotes the substring Si,Si+1,⋯,Sj .
Match Subset Si With Si+1, ....... Sj For anagram.
To View My Solution:
No comments:
Post a Comment