fork download
  1. Sum = 0
  2. x = input()
  3. if len(list(x)) == 0:
  4. print("0")
  5. else:
  6. sentence = x.strip()
  7. List = list(sentence)
  8. for i in range(len(List)):
  9. if List[i] == " ":
  10. Sum += 1
  11. print(Sum+1)
Success #stdin #stdout 0.03s 9728KB
stdin
 
stdout
1