Skip to content

Latest commit

 

History

History
 
 

htmlEndTagByStartTag

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Check Out My YouTube Channel

Algorithm Challenge Available At CodeFights

You are implementing your own HTML editor. To make it more comfortable for developers you would like to add an auto-completion feature to it.

Given the starting HTML tag, find the appropriate end tag which your editor should propose.

If you are not familiar with HTML, consult with this note.

Example

  • For startTag = "", the output should be htmlEndTagByStartTag(startTag) = "";

  • For startTag = "", the output should be htmlEndTagByStartTag(startTag) = "".

Hints

  • split()
  • toString()

Input/Output

  • [execution time limit] 5 seconds (ts)

  • [input] string startTag

    The total number of legs in the house.

Guaranteed constraints:

3 ≤ startTag.length ≤ 75.

  • [output] string