class Idiom219ReplaceMultipleSpacesWithSingleSpace {
	public static void main(String[] args) {
		var s =
		"q w  e   r     t    \n" +
		"\n" +
		"\n" +
		"y";

		String t = s.replaceAll("\\s+", " ");
		System.out.println(t);
	}
}