You are given a string ‘s’.Your task is to find whether string is beautiful or not. A string is said to be beautiful whenever string is made up of only three characters. All the three characters must be distinct.Print true if string is beautiful and false when it is not beautiful
You are given a string ‘s’.Your task is to find whether string is
beautiful or not. A string is said to be beautiful whenever string is
made up of only three characters. All the three characters must be
distinct.Print true if string is beautiful and false when it is not
beautiful
const readline = require('readline');
const inp = readline.createInterface({
input: process.stdin
});
const userInput = [];
inp.on("line", (data) => {
userInput.push(data);
});
inp.on("close", () => {
var data = userInput[0].split(" ");
var a = String(data[0]);
var b = a.split('');
var c= true;
if(b.length==3)
c=true;
if(b[0]==b[1]||b[1]==b[2]||b[0]==b[2])
c=false;
if(c)
console.log('1');
else
console.log('0')
});
const readline = require('readline');
const inp = readline.createInterface({
input: process.stdin
});
const userInput = [];
inp.on("line", (data) => {
userInput.push(data);
});
inp.on("close", () => {
var data = userInput[0].split(" ");
var a = String(data[0]);
var b = a.split('');
var c= true;
if(b.length==3)
c=true;
if(b[0]==b[1]||b[1]==b[2]||b[0]==b[2])
c=false;
if(c)
console.log('1');
else
console.log('0')
});
Comments
Post a Comment