# Leetcode 434 - Number of segments in a string

Note

• Know how to use reduce: You have to return something everytime!

You are given a string s, return the number of segments in the string.

A segment is defined to be a contiguous sequence of non-space characters.

Example