#C14751. String Lengths Dictionary (Excluding Strings with Digits)
String Lengths Dictionary (Excluding Strings with Digits)
String Lengths Dictionary (Excluding Strings with Digits)
You are given a single line of input which is a valid JSON array. The array may contain items of various types including strings, numbers, and booleans. Your task is to create a dictionary (JSON object) where each key is a string from the input that does not contain any digit and its value is the length of that string. Items that are not strings, or strings that contain any numerical digits, should be ignored.
For example, given the input array: ["apple", "banana", "cherry"]
, the correct output is {"apple":5,"banana":6,"cherry":6}
.
Note: All formulas, if any, should be written in \(\LaTeX\) format. In this problem no complex formula is required.
inputFormat
The input consists of a single line containing a valid JSON array. For instance:
["apple", "banana", "cherry"]
The array elements can be of different types (strings, numbers, booleans, etc.).
outputFormat
Output a JSON object (dictionary) on a single line. Each key is a string from the input (that does not contain any digits) and its corresponding value is the length of that string.
For example, for the input array ["apple", "banana", "cherry"]
, the output should be {"apple":5,"banana":6,"cherry":6}
.
["apple", "banana", "cherry"]
{"apple":5,"banana":6,"cherry":5}