How to find out particular input is an user or a Group?

How to find out particular input is an user or a Group, if the data type of input variable is user or group?

Based on whether its user or group I want to get users full name or group name.

  Discussion posts and replies are publicly visible