Character Frequencies Across Strings
Problem statement
Given an array of printable ASCII strings, count the total number of occurrences of every character across all strings.
Return the frequency map as a two-column String[][]. Each row must be [character, count], where character is a one-character string and count is its decimal frequency. Order rows by the first appearance of each character while scanning the input strings from left to right.
Characters are case-sensitive, and spaces and punctuation are counted like any other printable ASCII character. If no character appears, return an empty matrix. Do not use a built-in frequency-counter utility such as Python's Counter.
Function
characterFrequencies(strings: String[]) → String[][]Examples
Example 1
strings = ["hello","world"]return = [["h","1"],["e","1"],["l","3"],["o","2"],["w","1"],["r","1"],["d","1"]]Scanning left to right first discovers h, e, l, o, w, r, d. Across both strings, l occurs three times and o occurs twice; every other discovered character occurs once.
Example 2
strings = ["Aa!"," A"]return = [["A","2"],["a","1"],["!","1"],[" ","1"]]Uppercase A and lowercase a are distinct. Punctuation and the space are counted, and rows retain first-appearance order.