you can add the capability edit_published_posts
to your contributor
role and this will do what you are after.
edit_published_posts
Since 2.0
User can edit their published posts. This capability is off by default.
The core checks the capability edit_posts, but on demand this check is changed to edit_published_posts.
If you don’t want a user to be able to edit their published posts, remove this capability. (see also this comment on the Role Manager Plugin Homepage).
And the code to do this is very simple.
function add_theme_caps() {
$role = get_role( 'contributor' );
$role->add_cap( 'edit_published_posts' );
}
add_action( 'admin_init', 'add_theme_caps');
https://codex.wordpress.org/Roles_and_Capabilities#edit_published_posts