Problems

classList Simulator

EasyDOM & Events

Simulate element.classList. Input: line 1 — initial space-separated class list (may be empty); following lines — operations: add x, remove x, toggle x. Print the final class list space-separated (insertion order, no duplicates), or (empty).

Input: initial classes then operations. Output: final class list.

Your program reads from stdin and prints to stdout.

Example 1

Input: btn primary add active remove primary

Output: btn active

Hints

JavaScriptDOM
classList Simulator | CodeForge AI