Learn
Exam

String Formatting

Difficulty
STARTER

Problem

Given a string word, write a function solution that formats the string in the format "{word} is {length of word}". For example, if word is "hello", the function should return "hello is 5".


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" "hello is 5"
2 "algorithm" "algorithm is 9"
3 "a" "a is 1"

Explanation for Test Case 1

  • When word = "hello", it returns "hello is 5".

Explanation for Test Case 2

  • When word = "algorithm", it returns "algorithm is 9".

Explanation for Test Case 3

  • When word = "a", it returns "a is 1".