Home > Java > javaTutorial > How to solve the problem of independent substrings in Java loop string

How to solve the problem of independent substrings in Java loop string

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-05-17 16:34:19
forward
1118 people have browsed it

##Title description

Assume that s is an infinitely looping string "abcdefghijklmnopqrstuvwxyz", and s is a string like "...zabcdefghijklmnopqrstuvwxyza...". Now you are given another string p. Find out how many distinct strings there are in p. substrings of , such that they are also substrings of s. p contains only English lowercase letters and the length of p may be greater than 10,000.

Sample Description ##Input:

a Output
: 1Explanation
: Only 'a' is a substring of s.
Input
: cacOutput
: 2 Explanation
: Only 'a' and 'c' are children of s string.
Input
:zab Output
: 6Explanation
:'z','a','b', 'za', 'ab', 'zab' are all substrings of s.

Code:

How to solve the problem of independent substrings in Java loop string

##

The above is the detailed content of How to solve the problem of independent substrings in Java loop string. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Install JAVA
From 1970-01-01 08:00:00
0
0
0
Unable to install java
From 1970-01-01 08:00:00
0
0
0
Can java be used as the backend of the web?
From 1970-01-01 08:00:00
0
0
0
Is this in Java language?
From 1970-01-01 08:00:00
0
0
0
Help: JAVA encrypted data PHP decryption
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template