Target The aim of this work is to use control structures and loops. Read carefully the problem and understand what needs to be done. Read your description is given and when you understand how it works, then start designing its solution and its implementation on the computer applying the syntax and semantics of the language Java programming. Write a LongestDupSubstring.java program that accepts a string as input and compute and print the longest sub-string displayed in two times without overlap (see 5th example for overlap). If there are more from one of such sub-strings, the program displays the first one it finds as well the number of characters in the substring. If there is no substring that appears 2 times, then the program will not print anything. Execution examples (the user's input is red and the longer in length 2 substrings) 1 Example Give a string: again and again Longest substring: again Longest substring size: 5

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Target
The aim of this work is to use control structures
and loops. Read
carefully the problem and understand what
needs to be done. Read your description
is given and when you understand how it
works, then start designing its solution and
its implementation on the computer applying
the syntax and semantics of the language
Java programming.
Write a LongestDupSubstring.java program that
accepts a string as input
and compute and print the longest sub-string
displayed in two
times without overlap (see 5th
example for overlap). If there are more
from one of such sub-strings, the program
displays the first one it finds as well
the number of characters in the substring. If
there is no substring that
appears 2 times, then the program will not print
anything.
Execution examples (the user's input is red and
the longer in length 2 substrings)
1 Example
Give a string: again and again
Longest substring: again
Longest substring size: 5
2 Example
Give a string: seven saints and seven dinners
Longest substring: seven
Longest substring size: 6
Note: The answer is completed in the space
and is 6 characters.
Transcribed Image Text:Target The aim of this work is to use control structures and loops. Read carefully the problem and understand what needs to be done. Read your description is given and when you understand how it works, then start designing its solution and its implementation on the computer applying the syntax and semantics of the language Java programming. Write a LongestDupSubstring.java program that accepts a string as input and compute and print the longest sub-string displayed in two times without overlap (see 5th example for overlap). If there are more from one of such sub-strings, the program displays the first one it finds as well the number of characters in the substring. If there is no substring that appears 2 times, then the program will not print anything. Execution examples (the user's input is red and the longer in length 2 substrings) 1 Example Give a string: again and again Longest substring: again Longest substring size: 5 2 Example Give a string: seven saints and seven dinners Longest substring: seven Longest substring size: 6 Note: The answer is completed in the space and is 6 characters.
З Еxample
Give a string: Seven saints and seven sinners
Longest substring: even s
Longest substring size: 6
4 Example
Give a string: Mary had a little lamb
Longest substring: I
Longest substring size: 2
5 Example
Give a string: racecaracecar
Longest substring: raceca
Longest substring size: 6
Note: Here one can say that the maximum sub-
string is racecar but
there is overlap because where the first racecar
subset ends, it already has
start the 2nd
racecar substring so because we do not want
overlap, we can
take either rareca or acecar
An important part of the evaluation will be the
speed of program execution.
Also, a program to get all the credits is
necessary to:
1. uses comments
2. aligned code
3. self-explanatory names for variables
4. Input data controls
5. Correct output results
Transcribed Image Text:З Еxample Give a string: Seven saints and seven sinners Longest substring: even s Longest substring size: 6 4 Example Give a string: Mary had a little lamb Longest substring: I Longest substring size: 2 5 Example Give a string: racecaracecar Longest substring: raceca Longest substring size: 6 Note: Here one can say that the maximum sub- string is racecar but there is overlap because where the first racecar subset ends, it already has start the 2nd racecar substring so because we do not want overlap, we can take either rareca or acecar An important part of the evaluation will be the speed of program execution. Also, a program to get all the credits is necessary to: 1. uses comments 2. aligned code 3. self-explanatory names for variables 4. Input data controls 5. Correct output results
Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY