CF291B.Command Line Arguments

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The problem describes the properties of a command line. The description somehow resembles the one you usually see in real operating systems. However, there are differences in the behavior. Please make sure you've read the statement attentively and use it as a formal document.

In the Pindows operating system a strings are the lexemes of the command line — the first of them is understood as the name of the program to run and the following lexemes are its arguments. For example, as we execute the command " run.exe one, two . ", we give four lexemes to the Pindows command line: "run.exe", "one,", "two", ".". More formally, if we run a command that can be represented as string s (that has no quotes), then the command line lexemes are maximal by inclusion substrings of string s that contain no spaces.

To send a string with spaces or an empty string as a command line lexeme, we can use double quotes. The block of characters that should be considered as one lexeme goes inside the quotes. Embedded quotes are prohibited — that is, for each occurrence of character """ we should be able to say clearly that the quotes are opening or closing. For example, as we run the command ""run.exe o" "" " ne, " two . " " ", we give six lexemes to the Pindows command line: "run.exe o", "" (an empty string), " ne, ", "two", ".", " " (a single space).

It is guaranteed that each lexeme of the command line is either surrounded by spaces on both sides or touches the corresponding command border. One of its consequences is: the opening brackets are either the first character of the string or there is a space to the left of them.

You have a string that consists of uppercase and lowercase English letters, digits, characters ".,?!"" and spaces. It is guaranteed that this string is a correct OS Pindows command line string. Print all lexemes of this command line string. Consider the character """ to be used only in order to denote a single block of characters into one command line lexeme. In particular, the consequence is that the given string has got an even number of such characters.

该题目描述了命令行的特性。其描述方式与真实操作系统中常见的说明类似,但在具体行为上存在差异。请务必仔细阅读题干,并将其视为正式文档。

在 Pindows 操作系统中,字符串是命令行的词法单元(lexeme)—— 其中第一个词法单元被理解为待执行程序的名称,其余词法单元则为其参数。例如,当我们执行命令 " run.exe one, two . " 时,Pindows 命令行将接收到四个词法单元:"run.exe"、"one,"、"two"、"."。更形式化地说,若我们执行一条可表示为字符串 ss(不含引号)的命令,则该命令行的词法单元即为字符串 ss 中极大(即按包含关系不可再扩展)的、不包含空格的子串。

若要将含空格的字符串或空字符串作为单个命令行词法单元传递,可使用双引号(")。引号内部的字符块将被视为一个整体词法单元。禁止嵌套引号—— 即对每个出现的字符 ",我们都必须能明确判定其为左引号(opening quote)还是右引号(closing quote)。例如,当我们运行命令 ""run.exe o" "" " ne, " two . " " " 时,Pindows 命令行将接收到六个词法单元:"run.exe o"、""(空字符串)、" ne, "、"two"、"."、" "(单个空格)。

保证命令行的每个词法单元均满足如下条件:它要么两侧均为空格,要么至少有一侧紧邻命令行字符串的边界。该条件的一个推论是:每个左引号(")要么是字符串的第一个字符,要么其左侧必为一个空格。

你将获得一个仅由大小写英文字母、数字、字符 .,?!" 及空格组成的字符串。题目保证该字符串是一个合法的 Pindows 操作系统命令行字符串。请输出该命令行字符串所对应的所有词法单元。注意:字符 " 仅用于将一段连续字符标记为单个命令行词法单元。特别地,该性质意味着输入字符串中 " 的总数必为偶数。

输入格式

The single line contains a non-empty string s. String s consists of at most 105 characters. Each character is either an uppercase or a lowercase English letter, or a digit, or one of the ".,?!"" signs, or a space.

It is guaranteed that the given string is some correct command line string of the OS Pindows. It is guaranteed that the given command line string contains at least one lexeme.

单行输入包含一个非空字符串 ss。字符串 ss 最多包含 10510^5 个字符。每个字符均为大写或小写英文字母、数字、符号 .,?! 之一,或为空格。

保证所给字符串是操作系统 Pindows 的一条合法命令行字符串。保证该命令行字符串中至少包含一个词法单元(lexeme)。

输出格式

In the first line print the first lexeme, in the second line print the second one and so on. To make the output clearer, print the "<" (less) character to the left of your lexemes and the ">" (more) character to the right. Print the lexemes in the order in which they occur in the command.

Please, follow the given output format strictly. For more clarifications on the output format see the test samples.

第一行输出第一个词法单元,第二行输出第二个词法单元,依此类推。为使输出更清晰,请在每个词法单元左侧打印 <(小于号)字符,右侧打印 \>(大于号)字符。请按词法单元在命令中出现的顺序输出它们。

请严格遵循给定的输出格式。有关输出格式的更多说明,请参见测试样例。

输入输出样例

  • 输入#1

    &quot;RUn.exe O&quot; &quot;&quot; &quot;   2ne, &quot; two! . &quot; &quot;

    输出#1

    &lt;RUn.exe O&gt;
    &lt;&gt;
    &lt;   2ne, &gt;
    &lt;two!&gt;
    &lt;.&gt;
    &lt; &gt;
  • 输入#2

    firstarg   second   &quot;&quot;

    输出#2

    &lt;firstarg&gt;
    &lt;second&gt;
    &lt;&gt;

输入解题思路,AI测评打分。不知道怎么写?

首页