Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 05. HTML
- You will receive 3 lines of input. On the first line you will receive a title of an article. On the next line you will receive the content of that article. On the next n lines until you receive "end of comments" you will get the comments about the article. Print the whole information in html format. The title should be in "h1" tag (<h1></h1>); the content in article tag (<article></article>); each comment should be in div tag (<div></div>). For more clarification see the example below
- Example
- Input Output
- SoftUni Article <h1>
- Some content of the SoftUni article SoftUni Article
- some comment </h1>
- more comment <article>
- last comment Some content of the SoftUni article
- end of comments </article>
- <div>
- some comment
- </div>
- <div>
- more comment
- </div>
- <div>
- last comment
- </div>
- using System;
- using System.Collections.Generic;
- public class Program
- {
- public static void Main()
- {
- var titleOfArticle = Console.ReadLine();
- var contentOfArticle = Console.ReadLine();
- var listOfComments = new List<string>();
- var commentsOfArticle = "";
- while ((commentsOfArticle = Console.ReadLine()) != "end of comments")
- {
- listOfComments.Add(commentsOfArticle);
- }
- Console.WriteLine($"<h1>\n {titleOfArticle}\n</h1>\n<article>\n {contentOfArticle}\n</article>");
- Console.WriteLine($"<div>\n {string.Join("\n</div>\n<div>\n ", listOfComments)}\n</div>");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment