#C13404. Character Positions
Character Positions
Character Positions
Given a string composed exclusively of lowercase alphabetic characters, your task is to compute and output a JSON-formatted dictionary. Each key in the dictionary should be a distinct character found in the string, and the corresponding value is a list (using 0-based indexing) of all positions at which that character appears in the string.
For example, given the string abacabad
, the output should be:
The input will be provided as a single line from standard input, and the result should be printed to standard output as a valid JSON string.
inputFormat
The input consists of a single line containing a string s of lowercase English letters.
Constraints: 0 ≤ |s| ≤ 105.
outputFormat
Print a JSON-formatted dictionary where each key is a character from the input and the corresponding value is a list of all indices (0-based) where that character occurs in the string. The dictionary keys should be enclosed in double quotes.
## samplea
{"a": [0]}