// your code goes here
function findLinesWithTwoSymbol(input) {
// Split the input into lines you can write another symbol for split
const lines = input.split('\n');
// Iterate through each line
lines.forEach(line => {
const charCount = [];
// Iterate through each character in the line
for (let char of line) {
// Get the character code as the index (unique for each character)
const index = char.charCodeAt(0);
// Increment the count at the corresponding index
charCount[index] = (charCount[index] || 0) + 1;
}
// Check if any character appears exactly twice
if (charCount.some(count => count === 2)) {
console.log(line);
}
});
}
// Example usage:
const input = `asdf
fdas
asds
d
fm
dfaa
aaaa
aabb
aaabb`;
findLinesWithTwoSymbol(input);
Ly8geW91ciBjb2RlIGdvZXMgaGVyZQoKZnVuY3Rpb24gZmluZExpbmVzV2l0aFR3b1N5bWJvbChpbnB1dCkgewogIC8vIFNwbGl0IHRoZSBpbnB1dCBpbnRvIGxpbmVzIHlvdSBjYW4gd3JpdGUgYW5vdGhlciBzeW1ib2wgZm9yIHNwbGl0CiAgY29uc3QgbGluZXMgPSBpbnB1dC5zcGxpdCgnXG4nKTsKCiAgLy8gSXRlcmF0ZSB0aHJvdWdoIGVhY2ggbGluZQogIGxpbmVzLmZvckVhY2gobGluZSA9PiB7CiAgICBjb25zdCBjaGFyQ291bnQgPSBbXTsKCiAgICAvLyBJdGVyYXRlIHRocm91Z2ggZWFjaCBjaGFyYWN0ZXIgaW4gdGhlIGxpbmUKICAgIGZvciAobGV0IGNoYXIgb2YgbGluZSkgewogICAgICAvLyBHZXQgdGhlIGNoYXJhY3RlciBjb2RlIGFzIHRoZSBpbmRleCAodW5pcXVlIGZvciBlYWNoIGNoYXJhY3RlcikKICAgICAgY29uc3QgaW5kZXggPSBjaGFyLmNoYXJDb2RlQXQoMCk7CgogICAgICAvLyBJbmNyZW1lbnQgdGhlIGNvdW50IGF0IHRoZSBjb3JyZXNwb25kaW5nIGluZGV4CiAgICAgIGNoYXJDb3VudFtpbmRleF0gPSAoY2hhckNvdW50W2luZGV4XSB8fCAwKSArIDE7CiAgICB9CgogICAgLy8gQ2hlY2sgaWYgYW55IGNoYXJh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