The online tutoring platform ‘TutoringGuide’ whishes to organize son online assessment test in various subjects for its students. The subjects will be identified by its examination code is a string tagged ‘a-z’ or ‘A-Z’. The examination code is auto generated by the system. While generating the examination code, some bug in the system allowed the entry of numbers automatically. Now the professional needs to identify the total count of numbers present in the examination code before creating a script to remove the bug.
Input Format:
Write an algorithm to find out the total count of the numbers present in the examination codes.
The input consists of a string – textInput, representing the examination code.
Output Format:
Print an integer representing the count of numbers present in the examination code.
Note: textInput consist of whitespaces, alphabets and numbers only.
Sample Input:
aaA 234bcB sadC5678 hsagd
Sample Output:
7
"FarwayHome" is an online platform that provides its users with property buying and selling services. Through this platform a buyer can register a plot online. Each buyer is provided with a plot registration number. When a customer buys a plot from a seller, the system automatically generates a plot allotment number through the registration number. To generate the plot allotment number, each even digit of the plot registration number is replaced by the Kth digit after it in the number. The odd digits in the number are not replaced. For the last K digits, the series of digits in the plot number is considered in the cyclic manner.
Input Format:
Write an algorithm to find the plot allotment number.
The first line of the input consists of an integer – plotRegistrationNum, representing the plot registration number.
Output Format:
The second line consists of an integer – valueK, an integer representing the value of K.
Print an integer representing the plot allotment number.
Note: Consider zero(0) as an even and one(1) as an odd number.
Constraints:
0 < plotRegistrationNum >= 10^5
Sample Input:
25643
3
Sample Output:
45253
-
Create unique device names to be used in a residential IoT (Internet of Things) system. If a device name already exists in the system, an integer number is added at the end of the name to make it unique. The integer added starts with 1 and is incremented by 1 for each new request of an existing device name. Given a list of device name requests, process all requests and display an array of the corresponding unique device names.
Constraints
- 1<=n<=10^4
- 1<=length of devicenames[i]<=20
- devicenames[i] contains only lowercase English letters in the range ASCII[a-z].
The first line contains an integer, n, denoting the size of the array.
Output Format:
Each line i of the n subsequent lines (where 0<=i<n) contains a string.
Display unique device names in n lines.
Sample Input:
6
switch
tv
switch
tv
switch
tv
Sample Output:
switch
tv
switch1
tv1
switch2
tv2
-
A company is transmitting its data to a new server. There are N files. Each file contains numeric data. Before being transmitted the data encrypted for security. The company wishes to encrypt the data will be converted into its binary form from the decimal. Bits in binary form will be inverted and then the inverted new binary formed will be converted back into a decimal number.
Input Format:
Write an algorithm to encrypt the data as per the given requirements.
The first line of input consists of an integer - numData, representing the number of data entries (N).
Output Format:
The last line consists of N space-separated integers representing the data that is to be encrypted.
Print N space-separated integers representing the encrypted data of each file after following the given steps.
Sample Input:
4
65 29 56 34
Sample Output:
62 2 7 29
-
On the eve of the Silver Jubilee Celebrations of the college, the college management has decided to give Lucky Prizes for students whose enrolment numbers.
- does not contain any even digits
- does not start or end with 1
Given the enrollment number of a student, write a program to find whether the student is eligible for the lucky prize or not.
Input Format:
Input consists of the enrollment number of the student.
Output Format:
Output consists of a string that is either 'yes' or 'no'.
Sample Input1:
Print 'yes' if the student is eligible and print 'no' otherwise.
379517
Sample Output1:
yes
Sample Input2:
1371
Sample Output2:
no
Sample Input3:
3234
Sample Output3:
no
-
In cricket, a captain is said to be lucky if he wins the toss in at least half of the matches.
Input Format:
Given the information regarding n matches, find whether a captain is lucky or not. W corresponds to winning the toss and L corresponds to losing the toss.
Assume: Maximum length of string is 50.
Input consists of a string that gives information regarding 'n' matches. Assume that the length of the string is always even.
Output Format:
Print Invalid Input if any character in the input is invalid. The valid characters in the input are 'W' (Win) and 'L' (Loss).
Sample Input1:
Print Lucky if the captain has won the toss in at least half of the matches.
Print Unlucky if the captain has not won the toss in at least half of the matches.
WLWLWW
Sample Output1:
Lucky
Sample Input2:
WLWLLL
Sample Output2:
Unlucky
Sample Input3:
WLWLEW
Sample Output3:
Invalid Input