Retirez les espaces supplémentaires java
String after = before.trim().replaceAll(" +", " ");
yuan Tao
String after = before.trim().replaceAll(" +", " ");