CCF Series Template generation System (201509-3)

Source: Internet
Author: User

Question Name: Template generation System

Question number: 201509-3
Time limit: 1.0s
Memory Limit: 256.0MB

Problem Description Chengcheng recently set up a Web site where some of the pages come from different data records in the database, but the basic structure of the page is the same. For example, for a page that displays user information, when the user is Tom, the source code for the page is


And when the user is Jerry, the source code of the Web page is


Examples of this are many of the sites that contain dynamic content. To simplify the work of generating web pages, Chengcheng felt he needed to introduce a set of template generation systems.
A template is text that contains special tags. The template used by Chengcheng contains only a special tag in the format {{VAR}}, where VAR is a variable. The token is replaced by the value of the variable VAR when the template is generated. For example, if the variable name = "Tom", then {{name}} will generate Tom. The specific rules are as follows:
• The variable name consists of uppercase and lowercase letters, numbers, and underscores (_), and the first character is not a number and is not longer than 16 characters.
• The variable name is case-sensitive, and name and name are two different variables.
• The value of the variable is a string.
• If a variable in the tag is not defined, an empty string is generated, which is equivalent to removing the tag from the template.
• Templates are not generated recursively. That is, if the value of the variable contains the contents of a shape such as {{VAR}}, no further substitutions are made. Input format the first line of input contains two integers m, n, which represent the number of rows of the template and the number of variables given when the template was generated.
Next m line, each line is a string representing the template.
Next n rows, each row represents a variable and its value, separated by a space. The value is a string, enclosed in double quotation marks ("), which can contain any printable ASCII character except double quotes (ASCII range 32, 33, 35-126). The output format output contains several lines that represent the results of the template generation. Sample Input 11 2
<! DOCTYPE html>
<title>user {{Name}}</title>
<body>
<p>email: <a href= "mailto:{{Email}" >{{Email}}</a></p>
<p>address: {{Address}}</p>
</body>
Name "David Beckham"
Email "[Email protected]" Sample output <! DOCTYPE html>
<title>user David beckham</title>
<body>
<p>email: <a href= "Mailto:[email protected]" >[email protected]</a></p>
<p>address: </p>
</body>
0≤n≤100
The input template has a line length of 80 characters or less (no line break).
Enter the guarantee template that all substrings starting with {{{} are valid, starting with two opening curly braces and a space, then the variable name, and ending with a space and two closing curly braces.
The value string for all variables in the input is no longer than 100 characters (not including double quotes).
Ensure that the names of all variables entered are different.

CCF Series Template generation System (201509-3)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.