class StringOperasjoner { public static void main ( String [] args ) { System . out . println(settInnStjerner( "hello" )); //Forventet resultat hel*lo System . out . println(settInnStjerner( "helllo" )); //Forventet resultat hel*l*lo System . out . println(settInnStjerner( "helloo" )); //Forventet resultat hel*lo*o System . out . println(settInnStjerner( "" )); //Forventet resultat System . out . println(settInnStjerner( "trollmannen" )); //Forventet resultat } public static String settInnStjerner ( String str ){ if (str.length() < 2) { return str; } if (str.charAt(0) == str.charAt(1)) { return str.charAt(0) + "*" + settInnStjerner( str.substring(1) ); } return str.charAt(0) + settInnStjerner( str.substring(1) ); } }