Untitled
unknown
plain_text
2 years ago
663 B
6
Indexable
S=input().split()
#print(S)
for i in range (len(S)):
S[i]=ord(S[i])
#print(S)
x=0
P=[]
if S[0]>S[1]:
P.append(S[0])
P.append(";")
for i in range (len(S)-2):
if S[i]<S[i+1]:
P.append(S[i])
if S[i]<S[i+1] and S[i+1]>S[i+2]:
P.append(S[i+1])
P.append(";")
if S[i]<S[i-1] and S[i]>S[i+1]:
P.append(S[i])
P.append(";")
if S[len(S)-1]>S[len(S)-2]:
P.append(S[len(S)-2])
P.append(S[len(S)-1])
P.append(";")
if S[len(S)-1]<S[len(S)-2]:
P.append(S[len(S)-1])
P.append(";")
wynik=0
for i in range (len(P)):
if P[i]==";":
wynik+=1
#print(P)
print(wynik)Editor is loading...
Leave a Comment