I found a expression: "Keep out of each other's hair".
Is it wrong if I say without "of"? I mean, is "Keep out each other's hair" is correct sentence?
Yeah, you need that of. Your version is basically wrong.
Technically, I think your version is grammatical, but it means something very different, something people don't say very often:
Alice: Okay, let's go in the pool!
Bob: Sure! But wait, the pool's full of bleach!
Alice: Bleach?
Bob: Yeah! And you don't want that on your hair!
Alice: And we do want it on our skin?
Bob: Never mind that! The important thing is not to get it on our hair!
Alice: And as you know, Bob, we're forbidden from touching our own hair by religious mandate!
Bob: That's right, so I'll keep your hair out of the pool, and you keep mine out of it!
Alice: So we'll both keep out each other's hair?
Bob: That's right!
That's the closest I can come to making sense of it.
In other words, if you remove of, it would no longer be the idiomatic expression you learned, and it'd be a stretch to come up with a context where it'd be possible to say.
So don't remove that of. You need it!
Dropping the of
, like dropping that
, is colloquially acceptable in some places.
However, in the main, it is a part of the sentence. To be formal, and to be unambiguous (see snailboat's answer), you should keep it.