PY
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
point = input().split(",")
lst = []
ind = []
for i in point:
if "P" in i:
lst.append(i)
ind.append(point.index(i))
point[point.index(i)] = ""
if len(ind) == 1:
new_lst = "".join(lst)
cp_point = list(new_lst[:])
f_occ = cp_point.index("P")
cp_point[f_occ] = ""
l_occ = cp_point.index("P")
f_lst = new_lst[f_occ:l_occ + 1]
res = f_lst.count("X") + 1
print(res)
else:
ver = ind[1] - ind[0]
ind_1 = []
for i in lst:
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run