NAJPF - Pattern Find
Your task is so simple given a string and a pattern. You find the pattern on the given string. If found print how many time found the pattern and their index. Otherwise print ‘Not Found’
Input:
The input line consists of a number T (1 ≤ T ≤ 50) test cases.
For each case given two string number A,B. the string and the pattern 1 ≤|A|, |B| ≤10^6
All character will be lower case Latin character. And | | is the length of string.
Output:
For each case print the number (found pattern from the given string) next line there position And Otherwise print 'Not Found' without quota.
There will a blank line between two cases.
Sample:
Input |
Output |
3 |
3 |
Hints:
hide comments
darkhire21:
2016-01-31 08:37:57
check test case
|
|
[Mayank Pratap]:
2015-10-19 09:17:07
After 3 WAs I solved this using Rabin-karp :) |
|
[Mayank Pratap]:
2015-10-15 10:22:13
Weak test cases ..
|
|
Oasis:
2015-08-04 18:55:07
i dont understand y my brute force solution is better than kmp......
|
|
Deepanshu Thakur:
2015-07-21 15:49:05
Got accepted with KMP and Z-algorithm but not sure why my Robin-Karp is giving me WA. Can anyone help me? {code link ;}
|
|
[Mayank Pratap]:
2015-06-18 10:12:05
C++ amazes me... :) |
|
---@@@----:
2015-06-01 07:48:32
Easy...!!!
|
|
Shubham Sinha:
2015-05-04 20:56:29
I was getting wa in code block and runtime error in ideone.
|
|
TLE:
2015-02-19 12:55:32
simple rabin karp....ac :)
|
Added by: | Najmuzzaman |
Date: | 2014-10-23 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU |