You are given a string s. Your task is to count the total number of characters in the string.
Return the count.
Example 1
Input: s = "hello"
Output: 5
Explanation: The string contains 5 characters.
Example 2
Input: s = "abcd"
Output: 4
Explanation: There are 4 characters in the string.
Example 3
Input: s = "a"
Output: 1
Explanation: The string has only one character.
Approach, complexity and clean code in every language. Sign in to unlock the editorial.
Your submissions, results and runtime history live here. Sign in to start your streak.
hello
5
python
6