Dynamic User Group Creation

I’m trying to allow for end users on my site to dynamically create and/or associate themselves with a group using a form on my site.
So when a user fills out the form, they will either choose to be associated with an existing group, or be given an option to create a new group.

Basically they click submit and either:
1) They join the selected group
OR
2) If the group does not exist, it will be created with the name they type in.

Is this possible?