What do you mean by "takes it as underline"?
Your code has syntax errors as qwerty said, and will always match %input as a valid channel name because it's essentially checking
if (& !iswm %input) ... which will always be true if %input is a single word (
& is the wildcard for a whole word).
Quite aside from all the bug/syntax talk, you probably want to be using $chantypes to check for a valid channel instead of hard-coding the #& prefixes.
ie.
if ($left(%input,1) !isin $chantypes) echo -a %input invalid channel name