https://github.com/simon-isler/repeated-substring
finding the longest repeated substring in a given text
https://github.com/simon-isler/repeated-substring
code-challenge
Last synced: 9 months ago
JSON representation
finding the longest repeated substring in a given text
- Host: GitHub
- URL: https://github.com/simon-isler/repeated-substring
- Owner: simon-isler
- License: mit
- Archived: true
- Created: 2019-08-30T16:16:04.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-13T16:41:14.000Z (over 6 years ago)
- Last Synced: 2025-02-26T01:31:19.040Z (11 months ago)
- Topics: code-challenge
- Language: Ruby
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# REPEATED SUBSTRING
This is the solution to the given task.
# Task
Develop TDD with ruby.
You are to find the longest repeated substring in a given text. Repeated substrings may not overlap. If more than one substring is repeated with the same length, print the first one you find.(starting from the beginning of the text).
NOTE: The substrings can't be all spaces.
## Example
### Input
The program should accept as its first argument a string/(more complex a path to a filename). The input string/file contains several lines. Each line is one test case. Each line contains a test string. E.g.
```
banana
am so uniqe
```
### Output
For each set of input produce a single line of output which is the longest repeated substring. If there is none, print out the string NONE. E.g.
```
an
NONE
```
# Setup
```
git clone git@github.com:simon-isler/repeated-substring.git
cd repeated_substring
gem install bundler
bundle install
```
# Run Tests
```
rspec
```
## Credits
Challenge from https://www.codeeval.com/open_challenges/53/, adapted by cyrilkyburz