Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 06715ea

Browse files
committed
finish one 6 kyu 2015年07月24日
1 parent 9ff6882 commit 06715ea

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎[6 kyu] String Suffixes.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def string_suffix(str_):
2+
sumSuffix = 0
3+
for n in range(len(str_)):
4+
sumSuffix += stringMatch(str_, str_[n:])
5+
return sumSuffix
6+
7+
def stringMatch(str_,toMatch):
8+
res = 0
9+
for n in range(min(len(str_),len(toMatch))):
10+
if str_[n] == toMatch[n]:
11+
res += 1
12+
else:
13+
break
14+
return res
15+
16+
print(string_suffix('ababaa'))

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /