Stop on First Invalid JSON Line

JavaScript Medium 3 views
Back to Questions

Problem Description

First line n and then n lines (any JSON). Parse line by line. If a line is invalid JSON, print BAD k (1-based) and stop. If all ok, print OK.

Input Format

Line1: n. Next n lines: JSON values.

Output Format

OK or BAD k.

Sample Test Case

Input:
3 1 {bad} 2
Output:
BAD 2

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next