Consider an -element array, , where each index in the array contains a reference to an array of integers (where the value of varies from array to array). See the Explanation section below for a diagram. Given , you must answer queries. Each query is in the format i j , where denotes an index in array and denotes an index in the array located at . For each query, find and print the value of element in the array at location on a new line. Click here to know more about how to create variable sized arrays in C++. Input Format The first line contains two space-separated integers denoting the respective values of (the number of variable-length arrays) and (the number of queries). Each line of the subsequent lines contains a space-separated sequence in the format k a[i] 0 ...
Given a string, , consisting of alphabets and digits, find the frequency of each digit in the given string. Input Format The first line contains a string, which is the given number. Constraints Given a string, , consisting of alphabets and digits, find the frequency of each digit in the given string. Input Format The first line contains a string, which is the given number. Constraints All the elements of num are made of english alphabets and digits. . Output Format Print ten space-separated integers in a single line denoting the frequency of each digit from to . Sample Input 0 a11472o5t6 Sample Output 0 0 2 1 0 1 1 1 1 0 0 Explanation 0 In the given string: occurs two times. and occur one time each. The remaining digits and don't occur at all. Sample Input 1 lw4n88j12n1 Sample Output 1 0 2 1 0 1 0 0 0 2 0 Sample Input 2 1v88886l256338ar0ekk Sample Output 2 1 1 1 2 0 1 2 0 5 0 #include<stdio.h>...
Comments
Post a Comment
If you have any doubt you ask me in comment section