22104_iSharp

2022-5-16 18:21| 发布者: Hocassian| 查看: 25| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89506112745600-Problem List-采集的数据-后羿采集器.html

Pro.ID

22104

Title

iSharp

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22104

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    You are developing a new fashionable language that is not quite unlike C, C++, and Java. Since your language should become an object of art and fashion, you call it i# (spelled i-sharp). This name combines all the modern naming trends and also hints at how smart you are.

    Your language caters for a wide auditory of programmers and its type system includes arrays (denoted with "[]"), references (denoted with "&"), and pointers (denoted with "*"). Those type constructors can be freely combined in any order, so that a pointer to an array of references of references of integers (denoted with "int&&[]*") is a valid type.

    Multiple variables in i# can be declared on a single line with a very convenient syntax where common type of variables is given first, followed by a list of variables, each optionally followed by additional variable-specific type constructors. For example, the following line:

    int& a*[]&, b, c*;

    declares variables a, b, and c with types "int&&[]*", "int&", and "int&*" correspondingly. Note, that type constructors on the right-hand sides of variables in i# bind to variable and their order is reversed when they are moved to the left-hand side next to type. Thus "int*& a" is equivalent to "int a&*".

    However, you discover that coding style with multiple variable declarations per line is confusing and is outlawed in many corporate coding standards. You decide to get rid of it and refactor all existing i# code to a single variable declaration per line and always specify type constructor next to the type it refers to (instead of the right-hand side of variable). Your task it to write such refactoring tool.

    输入

    The input file contains a single line with a declaration of multiple variables in i#. The line starts with a type name, followed by zero, one, or more type constructors, followed by a space, followed by one or more variable descriptors separated by "," (comma) and space, and terminated by ";" (semicolon). Each variable descriptor contains variable name, followed by zero, one, or more type constructors. Type name and variable names are distinct and consist of lowercase and uppercase English letters from "a" to "z" or "A" to "Z". The line contains at most 120 characters and does not contain any extra spaces.

    输出

    Description

    You are developing a new fashionable language that is not quite unlike C, C++, and Java. Since your language should become an object of art and fashion, you call it i# (spelled i-sharp). This name combines all the modern naming trends and also hints at how smart you are.

    Your language caters for a wide auditory of programmers and its type system includes arrays (denoted with "[]"), references (denoted with "&"), and pointers (denoted with "*"). Those type constructors can be freely combined in any order, so that a pointer to an array of references of references of integers (denoted with "int&&[]*") is a valid type.

    Multiple variables in i# can be declared on a single line with a very convenient syntax where common type of variables is given first, followed by a list of variables, each optionally followed by additional variable-specific type constructors. For example, the following line:

    int& a*[]&, b, c*;

    declares variables a, b, and c with types "int&&[]*", "int&", and "int&*" correspondingly. Note, that type constructors on the right-hand sides of variables in i# bind to variable and their order is reversed when they are moved to the left-hand side next to type. Thus "int*& a" is equivalent to "int a&*".

    However, you discover that coding style with multiple variable declarations per line is confusing and is outlawed in many corporate coding standards. You decide to get rid of it and refactor all existing i# code to a single variable declaration per line and always specify type constructor next to the type it refers to (instead of the right-hand side of variable). Your task it to write such refactoring tool.

    Input

    The input file contains a single line with a declaration of multiple variables in i#. The line starts with a type name, followed by zero, one, or more type constructors, followed by a space, followed by one or more variable descriptors separated by "," (comma) and space, and terminated by ";" (semicolon). Each variable descriptor contains variable name, followed by zero, one, or more type constructors. Type name and variable names are distinct and consist of lowercase and uppercase English letters from "a" to "z" or "A" to "Z". The line contains at most 120 characters and does not contain any extra spaces.

    Output

    Write to the output file a line for each variable declared in the input file. For each variable write its declaration on a single line in the same format as in the input le, but with all type constructors next to its type. Separate type with all type constructors from a variable name by a single space. Do not write any extra spaces.

    Sample Input

    Sample #1
    int& a*[]&, b, c*;

    Sample #2
    Double[][] Array[];

    Sample Output

    Sample #1
    int&&[]* a;
    int& b;
    int&* c;


    Sample #2
    Double[][][] Array;

    Source

    样例输入

    Sample #1
    int& a*[]&, b, c*;

    Sample #2
    Double[][] Array[];

    样例输出

    Sample #1
    int&&[]* a;
    int& b;
    int&* c;


    Sample #2
    Double[][][] Array;

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部