readiz   3년 전

nodejs 로 푸신 다른 분들 풀이 보니 정규표현식 쓰신 분들이 보이는데.. 해당 풀이가 깔끔해보여 저도 그렇게 접근해야했나 싶지만

제가 시도해본 방법에서 반례가 따로 존재하는지 궁금합니다. 17% 정도에서 계속 fail이 나는데, 아래 예시들과 게시판의 반례들은 다 통과 되는 것 같거든요.

the quick brown fox.
the <i><b>quick</b> brown</i> fox.
<doc>fox & socks.</doc>
3x+5>7
Null: &x00;
<doc>the quick brown fox.
the <i>quick <b>brown</i></b> fox
fox & socks.
3x+5>7
Null: &x0;
some ascii text????2#$@#$@#$ OK
balanced  <tag1><tag2>tags</tag2>brown</tag1> OK
additional <tag1><tag2>tag</tag2>without</tag1><tag3/>closing context. OK
popped off <tag1><tag2>in wrong</tag1></tag2> order.
stack non-empty <tag1>at</tag1>end<tag1>.
pop<tag1></tag1>from</tag2>empty stack.
incorrect <tag?><b>syntax</b>for tag</tag?>.
incorrect <tag/tag>syntax for tag</tag/tag>.
no match >tag
no match <tag
37<38 OK
38>37 OK
ampersand&ersand OK
hex number&xab99; OK
hex number&xAB99; OK
semicolon;part of ascii text OK
odd number of hex digits&x345;
ampersand without closing semicolon>xxx
tags that are not lowercase <Tag1>hello</Tag1>
blank line follows

multiple tags of the same name, nested: <tag1><tag1><tag1> <tag1/>hello </tag1> </tag1></tag1>
&at;
&bmp;
&l<t;
&aaa;
&xax;
</>
<></>
<><
/>
<b><
/b>


<>

댓글을 작성하려면 로그인해야 합니다.