<?php
if (preg_match('/^(?=.{6})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[\W_])/', 'HalloWord~2012'))
{
  print 'YES';
}
else
{
  print 'NO';
}
?>