Explanation

582.Find the Length of a String

Easy
Given a string text, return how many characters it contains. Spaces and punctuation count. A stringStringA sequence of characters, such as letters, digits, spaces and punctuation, treated as one value. is a sequence of characters, and its length is how many there are. Most languages store that number with the string, but C marks the end with a hidden null terminatorNull TerminatorThe character \0 that C places after the last character of a string to mark where it ends. instead, so counting characters is a real loop there.

Example 1:

Input: text = "hello"

Output: 5

Example 2:

Input: text = "a b"

Output: 3

+ 4 hidden test cases run on Submit.

Constraints:

  • ●1 ≤ text.length ≤ 1000
  • ●text contains printable ASCII characters

text =

hello