fork download
  1. # your code goes here
  2. DATA.read.split.each{|line|
  3. puts line
  4. m = line.match(
  5. /
  6. ^[a-zA-Z0-9]{,100}
  7. (?:
  8. [a-zA-Z0-9]{1,100}
  9. | <a>[a-zA-Z0-9]{,100}(?:<b>[a-zA-Z0-9]{,100}<\/b>[a-zA-Z0-9]{,100})?<\/a>
  10. | <b>[a-zA-Z0-9]{,100}<\/b>
  11. )*$
  12. /x)
  13. puts (m ? 1 : 0)
  14. }
  15.  
  16. __END__
  17. <a>ruby<b>php</b>python</a><a><b></b></a><a></a>
  18. <a>ruby<b>php</b>python</a><a></b></a><a></a>
  19. <a>ruby<b>php</b>python</a><a><b></a><a></a>
  20. <a>ruby<b>php</b>python</a><a><b></b></a><a>
  21. vvvc<a>ruby<b>php</b>python</a><a><b></b></a><a></a>
  22.  
Success #stdin #stdout 0.01s 7456KB
stdin
Standard input is empty
stdout
<a>ruby<b>php</b>python</a><a><b></b></a><a></a>
1
<a>ruby<b>php</b>python</a><a></b></a><a></a>
0
<a>ruby<b>php</b>python</a><a><b></a><a></a>
0
<a>ruby<b>php</b>python</a><a><b></b></a><a>
0
vvvc<a>ruby<b>php</b>python</a><a><b></b></a><a></a>
1