It really is not that difficult! Go about it sequentially. First replace all the "a"s as you want them to be replaced, then all the "d"s and then all the "b"s. Here's a simple example with replace()
:
public static void main(String args[]) {
System.out.print("Word:");
Scanner scanner = new Scanner(System.in);
String foo = scanner.next();
foo = foo.replace("a", "aaa");
System.out.println(foo);
foo = foo.replace("d", "");
System.out.println(foo);
foo = foo.replace("bb", "b");
System.out.println(foo);
}
Let me know if this is what you wanted. Also, you could do this with charAt()
and String manipulation as well, but that would be a bit more involved.