Similar Items: Switching and finite automata theory