Consider a non-empty array Inarr of unique elements such as satisfies the following condition 0 Starting from the leftmost element in inarr, for each element Form all possible numbers by concatenating pair of elements in inarr such that the second element of the pair appears after the first element in inarr. From the numbers formed, find and add the unique Armstrong numbers) outarr in the order of occurrence of elements in inarr. If two pairs have the same first number, then consider the order of occurrence of second elements in the pairs An Armstrong number is equal the sum of its own digits each raised to the power of the number of digits in the number If there is no Armstrong number found, print-1 as output Input Format First line contains inarr, with the elements separated by ‘,’ (comma) Constraints Read the inputs from the standard input stream Output Format Print outarr, with the elements separated by ',' (comma) to the standard output stream Sample Input 0 15,3,1,70,53,7...
Comments
Post a Comment