forked from TechUni2020/lesson01
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
55 lines (41 loc) · 1.31 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# strs = "こはるはるここはるここはるはるここはるこはるはるはる"
# def countch(arg):
# count = 0
# for i in arg:
# count = count + 1
# return count
# def main():
# target1 = 'こはる'
# target2 = 'はるこ'
# result1 = 0
# result2 = 0
# length1 = countch(target1)
# length2 = countch(target2)
# name = []
# base = []
# for i in strs:
# base.append(i)
# name = ''.join(base)
# namelength = countch(name)
# if namelength == length1 or namelength == length2:
# #print(name)
# if name == target1:
# result1 = result1 + 1
# # そろったらリセット
# name = []
# elif name == target2:
# result2 = result2 + 1
# # そろったらリセット
# name = []
# # 一文字ずらして次の確認へ
# base = base[1:]
# #print(base)
# print(target1, result1)
# print(target2, result2)
# if __name__ == '__main__':
# main()
str = "こはるはるここはるここはるはるここはるこはるはるはる"
a =str.count("こはる",0,25)
b =str.count("はるこ",0,25)
print("こはる:{}".format(a))
print("はるこ:{}".format(b))