Virus DNA files As a future doctor, Jojo works in a laboratory that analyzes viral DNA. Due to the pandemic During the virus outbreak, Jojo received many requests to analyze whether there was any viral DNA in the patient. This number of requests made Jojo's job even more difficult. Therefore, Jojo ask Lili who is a programmer for help to make a program that can read the file containing the patient's DNA data and viral DNA and then match them. If on the patient's DNA found the exact same string pattern, then write to the index screen the found DNA. Data contained in the file testdata.in Input Format The first line of input is the number of test cases T The second row and so on as many as T rows are the S1 string of patient DNA and the S2 string of viral DNA separated by spaces Output Format The array index found the same string pattern. Constraints 1 ≤ T ≤ 100 3 ≤ |S2| ≤ |S1| ≤ 100 |S| is the length of the string. S will only consist of lowercase letters [a-z] Sample Input (testdata.in) 6 abbab ab cdefgh def pxzzt xyz ijklijkl ijkl kjldfjdlsjf nnn icumeyb oeibv Sample Output 0 2 4 1 N/A 0 4 N/A N/A Sample Input 3 zzzz zz xoxozy bc oqryc yc Sample Output 0 1 N/A 3 In the sample above, for example input: ababab ab then the string pattern 'ab' is found at index 0, 2 and 4 zzz zz then the string pattern 'zz' is found at index 0 and 1 oqryc yc then the string pattern 'yc' is found at index 3 Notes Even though it wasn't stated in the problem, by now you should know that the advantages spaces or lines are considered WRONG ANSWER.

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter1: Creating Java Programs
Section: Chapter Questions
Problem 18RQ
icon
Related questions
Question

Virus DNA files

As a future doctor, Jojo works in a laboratory that analyzes viral DNA. Due to the pandemic During the virus outbreak, Jojo received many requests to analyze whether there was any viral DNA in the patient. This number of requests made Jojo's job even more difficult. Therefore, Jojo ask Lili who is a programmer for help to make a program that can read the file containing the patient's DNA data and viral DNA and then match them. If on the patient's DNA found the exact same string pattern, then write to the index screen the found DNA. Data contained in the file testdata.in

Input Format

The first line of input is the number of test cases T
The second row and so on as many as T rows are the S1 string of patient DNA and the S2 string of viral DNA separated by spaces

Output Format

The array index found the same string pattern.

Constraints

1 ≤ T ≤ 100
3 ≤ |S2| ≤ |S1| ≤ 100
|S| is the length of the string.
S will only consist of lowercase letters [a-z]

Sample Input (testdata.in)

6
abbab ab
cdefgh def
pxzzt xyz
ijklijkl ijkl
kjldfjdlsjf nnn
icumeyb oeibv

Sample Output

0 2 4
1
N/A
0 4
N/A
N/A

Sample Input

3
zzzz zz
xoxozy bc
oqryc yc

Sample Output

0 1
N/A
3

In the sample above, for example input:
ababab ab then the string pattern 'ab' is found at index 0, 2 and 4
zzz zz then the string pattern 'zz' is found at index 0 and 1
oqryc yc then the string pattern 'yc' is found at index 3

Notes

Even though it wasn't stated in the problem, by now you should know that the advantages spaces or lines are considered WRONG ANSWER.

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT