编程介的小学生 2019-08-24 22:14 采纳率: 20.5%
浏览 93

The Simple Programming Language的解答

Problem Description
Consider the following programming language. This language contains only two types of statements: simple statements and compound statements. The simple statement is in the form “write (literal)”, where “write” is a key word indicating that the content of the literal should be written to the standard output. The content of literals is surrounded by a pair of double quotes. The compound statement is in the form “if () ” or “if () else ”. Here “if” and “else” are key words and “expression” can be either “1” or “0” indicating “true” or “false”. Statement can be either compound or simple, which means compound statements can be nested. Note that each “else” should match the nearest “if”.

Input
The input has multiple test cases. Every test case is exactly a statement. Every test case is ended with an empty line and there will be no empty lines within a statement. Please pay attention that empty lines separate the statements and adjacent statements are independent of each other.

Output
For all the contents of literals that should be written to the standard output, print them on a single line, without the double quotes. The contents of literals will contain only lower case letters.

Sample Input
write(“q”)

if(0) write(“x”) else write(“y”)

if(1) if(0) write(“x”) else write(“y”)

if(0) if(0) write(“x”) else write(“y”)

Sample Output
q
y
y

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 matlab图像高斯低通滤波
    • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
    • ¥15 钢筋实图交点识别,机器视觉代码
    • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
    • ¥50 400g qsfp 光模块iphy方案
    • ¥15 两块ADC0804用proteus仿真时,出现异常
    • ¥15 关于风控系统,如何去选择
    • ¥15 这款软件是什么?需要能满足我的需求
    • ¥15 SpringSecurityOauth2登陆前后request不一致
    • ¥15 禅道二次开发编辑版本,上传不了发行包