How to use the string() function?

I am working on an assignment that will return the string length in the number of characters. Here is what I've done so far, but I have no clue how to use the string() function. Any help would be appreciated.

But I must move on to the next level where I have to store
lastname,firstname into one variable and use the substr function to extract the last name and display the length of the last name. I do know it should be something like: