Learn
Exam

Calculate the Length of a String

Difficulty
STARTER

Problem

Given a string word, write a function solution that returns the length of the given string.


Constraints

  • word consists only of lowercase English letters.
  • The length of word is between 1 and 100 inclusive.

Test Case

Test Case Number word return
1 "hello" 5
2 "algorithm" 9
3 "a" 1

Explanation for Test Case 1

  • When word = "hello", the length of the string is 5.

Explanation for Test Case 2

  • When word = "algorithm", the length of the string is 9.

Explanation for Test Case 3

  • When word = "a", the length of the string is 1.