Replacing 'a' with 'b'

Report a typo

Write a program that reads a string and replaces all occurrences of the letter 'a' with the letter 'b'.

The program should print out the resulting string.

Sample Input 1:

aaa

Sample Output 1:

bbb

Sample Input 2:

bca

Sample Output 2:

bcb
Write a program in Java 17
import java.util.Scanner;

class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// start coding here
}
}
___

Create a free account to access the full topic