A to '#'

Problem

Write a program that outputs an English word consisting of uppercase letters by replacing all ‘A’ in the word with ’#‘.

input

A string is entered in the first line.

BANANA

output

Prints the changed word on the first line.

B#N#N#

Solution

using for ... of

function solution(s) {
	let answer = '';
	for (let x of s) {
		if (x === 'A') answer += '#';
		else answer += x;
	}
	return answer;
}

using regex

function solution(s) {
	return s.replace(/A/g, '#');
}