package test;
import java.text.DecimalFormat;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
String aa = "a b c D";
String bb = aa.substring(0,1);
String cc = bb;
for(int i = 1;i< aa.length();i++){
if(bb.equals(aa.substring(i,i+1))){
if(!bb.equals(" "))
cc += aa.substring(i,i+1);
}
else{
cc += aa.substring(i,i+1);
}
bb = aa.substring(i,i+1);
}
System.out.println(cc.trim());
}
}