Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Repeated Numbers


Eren wants to decode a number.After lots of trial and error, he finally figured out that the number is a count of repeated single-digit integers.

Write a program to help Eren print the decoded number given a string of integers N.


Input

The first line contains a string of integers N.


Output

The output contains a single integer representing count of repeated numbers in the input.


Explanation

For N = 212311 ,

1 and 2 are repeated.Therefore, the output is 2.


Sample Input1

212311

Sample Output1

2


Sample Input2

111

Sample Output2

1


Friend and Enemy

A group of F friends went to a haunted house.Each member was given a shirt with a number on it ranging from 1 to F. As they entered the haunted house, one of them was kidnapped and an enemy joined them.But unfortunately, the enemy didn't wear the shirt with the same number as the kidnapped one, instead wore the same as some other person.Find the numbers on the shirts of the enemy and the kidnapped person.


Input

The input is a single line containing space-separated positive integers from 1 to F.


Output

The output should be a single line containing the shirt numbers of the enemy and kidnapped person separated by a space.


Explanation

The given array is 3 1 5 2 1.

In the range from 1 to 5, the number 1 has occured twice and 4 is the missing number. So, 1 belongs to the enemy's shirt, and 4 belongs to kidnapped.Hence, the output should be 1 4.


Sample Input1

3 1 5 2 1

Sample Output1

1 4


Sample Input2

1 2 2 4

Sample Output2

2 3


The double Quote and single quote in 1 line

There are N intermediate stations between two places A and B. Find the number of ways in which a train can be made to stop at S number of these intermediate stations so that no two stopping stations are consecutive. Write a python module Station.py for above and import the module in main program .In main program define a function Get-Station(N,S)

which takes value of N & S and return integer result as shown in example by calling the appropriate function implemented in Station.py module. Also handle the possible exceptions and display the exception message in form of string. Do not use input function provide input in fixed form.


For Example : 1) Input : N= 12 , S= 4

Output: 126


2) Input : N= 2 , S = 4

Output : 0



Gwalior Fort is a popular tourist place in Gwalior, Madhya Pradesh. Everyday peoples registered to visit Fort as token provided based on first come basis. Everyday limited numbers of peoples are allowed to visit. The management selects a number A1 randomly every day and generates another number A2 as count of the total number of set bits (i.e., total no. of 1s) in binary representation of all numbers from 1 to A1. For example, A1=3 then A2=4 [1(01) +2(10) +3(11)]. So, write a python module CountBit.py to find A2 using A1. You need to import this module in main program. In main program define a function

G-T(n) which takes a number and return value as shown in example by calling the appropriate function implemented in CountBit.py module.



Example-1 : Input : 3 , Output : 4

Example-2 : Input : 7 , Output : 12


Your given a string of numbers A, the task is to find the max value from the string A ; you can add a '+' or '*' sign between two numbers. For Ex S=452 as 4*5*2 = 40 and 4*5+2=22 So 40 is maximum.

Write a python module Maxvalue.py for solving the above task. You need to import this module in main program. In main program define a function F-M(n) which takes a string and returns maximum value or error message as shown in example by calling the appropriate function implemented in Maxvalue,py module. Also handle the exceptions and display the exception message in the form of string. F-M(n) function must be generalized one.


You work in XYZ Company as a Python. The company officials want you to write code for reducing the dimensions of a dataset

Tasks to be performed: -

- Using load_digits function from sklearn import wines data

- Take a look at the shape of image data

- Import PCA, LDA and FactorAnalysis from Sklearn

- Project data in 2 D space using the PCA, LDA and FactorAnalysis algorithm form sklearn

- Take a look at the new data


There are N intermediate stations between two places A and B. Find the number of ways in which a train can be made to stop at S number of these intermediate stations so that no two stopping stations are consecutive. Write a python module Station.py for above and import the module in RollNo_W12B_3.py. In RollNo_W12B_3.py, define a function Get_Stations(N, S)  which takes value of N & S and return integer result as shown in example by calling the appropriate function implemented in Station.py module. Also handle the possible exceptions and display the exception message in form of string.


Example-1

Example-2

Example-3

Input:

12

4

 

Output:

126

Input:

16

5

 

Output:

792

Input:

2

4

 

Output:



Earthquake python program. shreya is learing about earthquakes and stumbles accroess an interesting fact: the magnitude of on earthquake is a logarithmic scale of the energy realeased by the earthquake. it is known that each time the magnitude increases by 1, the amount of energy ets multiplied by 32. your tas is to help shreya by determining, how many times is the amount of energy of a magnitude a earthquake compared to that of a magnitude B earthquake?

I/p : a=6 & b=4, 6 is 2 greater than 4, so a magnitude 6 earthquake has 32*32=1024 times as much energy as a magnitude 4 earthquake has. so, the output is 1024

Input : 6 4

O/p: 1024

I/p: 5 5

O/p: 1


 Kalinjar Fort is a popular tourist place in Bundelkhand, Utter Pradesh. Everyday peoples registered to visit Fort as token provided based on first come basis. Everyday limited numbers of peoples are allowed to visit. The management selects a number N1 randomly every day and generates another number N2 as count of the total number of set bits (i.e., total no. of 1s) in binary representation of all numbers from 1 to N1. For example, N1=3 then N2=4 [1(01) +2(10) +3(11)]. So, write a python module CountBit.py to find N2 using N1. You need to import this module in RollNo_W12B_2.py. In RollNo_W12B_2.py, define a function Get_Token(n) which takes a number and return value as shown in example by calling the appropriate function implemented in CountBit.py module.


 

 

Example-1

Example-2

Example-3

Input:

3

 

Output:

4

 

Input:

7

 

Output:

12Input:

8

 

Output:

13


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS