Length of all strings combined
Statement
Goal
Given a line of code, look for all strings enclosed in double quotes. Return the sum of lengths of all strings found (excluding the delimiters). The escape sequences are\\and
\"may be present and they count as 1 character.
Input
Line 1: A string representing the code to search for strings
Output
Line 1: A number representing the sum of lengths of all valid strings
Constraints
Length of string is less than 200
Example
Input
"hello"
Output
5
Game modes
Fastest, Shortest
Test cases
Test 1 Test
Input
"hello"
Output
5
Validator 1 Validator
Input
"world!"
Output
6
Test 2 Test
Input
console.log("codin", "game")
Output
9
Validator 2 Validator
Input
console.log("Clash", "of", "Code")
Output
11
Test 3 Test
Input
1 + 1
Output
0
Validator 3 Validator
Input
2 * 3
Output
0
Test 4 Test
Input
"\""
Output
1
Validator 4 Validator
Input
"\\"
Output
1
Test 5 Test
Input
{"\"":"\\"}
Output
2
Validator 5 Validator
Input
{"\\":["\\","\"\\"]}
Output
4
Test 6 Test
Input
""""""
Output
0
Validator 6 Validator
Input
""""""""""""
Output
0
Test 7 Test
Input
"\"\\"\\"\""
Output
3
Validator 7 Validator
Input
"\\"\\"""\\\""\\""\\"""\"\\"\\"""\"\\/"
Output
8
Test 8 Test
Input
a"b"c"d"e"f\"g
Output
2
Validator 8 Validator
Input
a"b\"c
Output
0
Solution language
Solution
Stub generator input