class Main {
public static String fullSpaceTrim(String str) {
if (str == null) {
return null;
}
int length = str.length();
int start = 0;
while ((start < length)
&& (str.charAt(start) == ' ' || str.charAt(start) == '\u3000')) {
++start;
}
int end = length - 1;
while ((end >= 0)
&& (str.charAt(end) == ' ' || str.charAt(end) == '\u3000')) {
--end;
}
return start > end ? "" : str.substring(start, end + 1);
}
}