import java.util.regex.*;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		String s = "hello 'cool1' word! 'cool2'";
		Pattern pattern = Pattern.compile("'([^']*)'");
		Matcher matcher = pattern.matcher(s);
		if (matcher.find()) {
			System.out.println(matcher.group(1));
		}
	}
}