Shelter dogs and inmates get second chance