THINK FIRST·CODE LATER

← All labs

Interview-question reviewer

Problem

Before interviewing instructors, Lina wants a tool that reviews her question list.

Read questions, one per line, until the end of input. Classify each (case-insensitive) using these rules in order:

  1. LEADING if it starts with don't you, wouldn't you, isn't it, wouldn't it, shouldn't or ends with , right?
  2. FUTURE if it contains would you or will you (a guess about future behaviour)
  3. OPEN if it starts with what, how, why, tell me, describe or walk me
  4. CLOSED if it starts with do , does , is , are , can , did , have , has
  5. otherwise OTHER

Print TYPE: question for each line. Then print Open: x, Closed: y, Leading: z, Future: f, Other: o and a final advice line:

  • Advice: remove leading questions if there is at least one LEADING question;
  • otherwise Advice: ask more open questions if OPEN questions are fewer than half of all questions;
  • otherwise Advice: good question list.

Input:

How do you prepare students for the midterm?
Wouldn't it be great if Buddy graded homework?
Do you use WeChat groups with students?
Tell me about the last question a student asked you at night.

Output:

OPEN: How do you prepare students for the midterm?
LEADING: Wouldn't it be great if Buddy graded homework?
CLOSED: Do you use WeChat groups with students?
OPEN: Tell me about the last question a student asked you at night.
Open: 2, Closed: 1, Leading: 1, Future: 0, Other: 0
Advice: remove leading questions

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.