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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Don't copy 

ASAP

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 2 steps with 5 images

Blurred answer
Knowledge Booster
Top down approach design
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education