DrawCode Practice Problem

Word Count with PySpark

Practice a classic MapReduce-style word count in PySpark. Given lines of text, count how many times each word appears (case-insensitive, ignore punctuation).

Examples

Input

lines = ["hello world", "hello spark"]

Output

[("hello", 2), ("world", 1), ("spark", 1)]

Constraints


Interactive Visualizer Workspace

Explore step-by-step interactive animations, memory state tracking, and live multi-language execution in DrawCode.

Launch Interactive Visualizer