⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
document
All Projects
document
Overview
Activity
Issues
Spent time
Gantt
Calendar
News
Documents
Wiki
Files
Download (502 Bytes)
Files
» strlong.py
UserName LastName
, 02/14/2025 10:40 AM
# 编写一个算法,实现从一个字符串中找出最长的不重复的字符串
def
strlong
(
str1
):
str0
=
[]
#取出以每个字母开头所有最长字符串
for
x
in
str1
:
for
y
in
str1
[
str1
.
index
(
x
):
len
(
str1
)
-
1
]:
str_x
=
''
if
y
not
in
x
:
str_x
=
x
+
y
else
:
str0
.
append
(
str_x
)
#比较长度
max
=
''
for
s
in
str0
:
if
len
(
s
)
>
len
(
max
):
max
=
s
return
max
« Previous
1
…
169
170
171
172
173
…
437
Next »
(171-171/437)
Loading...