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

Smallest Missing Number

Given a list of numbers, write a program to print the smallest positive integer missing in the given numbers.


Input


The input will be a single line containing numbers separated by space.


Output


The output should be a single line containing the smallest missing number from given numbers.


Explanation


For example, if the input numbers are 3, 1, 2, 5, 3, 7, 7.

The number 1, 2, 3 are present. But the number 4 is not. So 4 is the smallest positive integers that is missing from the given numbers.


Sample Input 1

3 1 2 5 3 7 7


Sample Output 1

4


Sample Input 2

5 5 2 3 1 8 8 4


Sample Output 2

6




Weekends

Given two dates D1 and D2, write a program to count number of Saturdays and Sundays from D1 to D2 (including D1 and D2).

The date in string format like "8 Feb 2021".


Input


The first line of input will contain date D1 in string format.

The second line of input will contain date D2 in string format.


Output


The output should a single line containing two integers separated by space.


Explanation


For example, if given dates are "25 Jan 2021" and "14 Feb 2021", the Saturdays and Sundays dates from "25 Jan 2021" to "14 Feb 2021" are

"30 Jan 2021" is a Saturday

"31 Jan 2021" is a Sunday

"6 Feb 2021" is a Saturday

"7 Feb 2021" is a Sunday

"13 Feb 2021" is a Saturday

"14 Feb 2021" is a Sunday

So output should be

Saturday: 3

Sunday: 3


Sample Input 1

25 Jan 2021

14 Feb 2021


Sample Output 1

Saturday: 3

Sunday: 3


Sample Input 2

25 May 2019

22 Dec 2021


Sample Output 2

Saturday: 135

Sunday: 135



Secret Message - 1

Given a string, write a program to mirror the characters of the string in alphabetical order to create a secret message.


Note: Mirroring the characters in alphabetical order replacing the letters 'a' with 'z', 'b' with 'y', ... , 'z' with 'a'. You need to mirror both uppercase and lowercase characters. You can ignore mirroring for all characters that are not letters.


abcdefghijklm

zyxwvutsrqpon 

nopqrstuvwxyz

mlkjihgfedcba


Input


The input will be a string in the single line containing spaces and letters (both uppercase and lowercase).


Output


The output should be a single line containing the secret message. All characters in the output should be in lower case.




Sample Input 1

python


Sample Output 1

kbgslm


Sample Input 2

Foundations


Sample Output 2

ulfmwzgrlmh


Given three sides of the triangle(a, b, c) as input. Write a program to determine whether the triangle is Equilateral, Isosceles or Scalene.Input


The first line of input will contain an integer A.

The second line of input will contain an integer B.

The third line of input will contain an integer C.Output


If the given sides A, B and C are equal, print "Equilateral".

In the given sides any of two sides are equal print "Isosceles".

If the given sides A, B, C are not equal to each other, print "Scalene".Explanation


For example, if the given sides are 4, 4, 4 the output should be "Equilateral".

Similarly, if the given sides are 3, 2, 3 the output should be "Isosceles".


Given a sentence S, write a program to print the frequency of each word in S. The output order should correspond with the word's input order of appearance.Input


The input will be a single line containing a sentence S.Output


The output contains multiple lines, with each line containing a word and its count separated by ": " with the order of appearance in the given sentence.Explanation


For example, if the given sentence is "Hello world, welcome to python world", the output should be

Hello: 1

world: 2

welcome: 1

to: 1

python: 1


Sample Input 1

Hello world welcome to python world


Sample Output 1

Hello: 1

world: 2

welcome: 1

to: 1

python: 1


Sample Input 2

This is my book


Sample Output 2

This: 1

is: 1

my: 1

book: 1


Please I need exact Output for the above question , i mean a code which satisfies both the above two sample inputs





Non-Adjacent Combinations of Two Words

Given a sentence as input, find all the unique combinations of two words and print the word combinations that are not adjacent in the original sentence in lexicographical order.


The input will be a single line containing a sentence.Output


The output should be multiple lines, each line containing a valid unique combination of two words. A valid combination will not contain the words that appear adjacent in the given sentence. Print "No Combinations" if there are no valid combinations_Explanation.


Sample Input 1

raju always plays cricket


Sample Output 1

always cricket

cricket raju

plays raju


Sample Input 2

python is a programming language


Sample Output 2

a language

a python

is language

is programming

language python

programming python


Please the output should be printed exactly as shown in the above testcases.


Write a program that reads a number and prints all of its binary digits: Print the remainder

number % 2, then replace the number with number / 2. Keep going until the number is 0. For 

example, if the user provides the input 13, the output should be

1


1

1


Write a program that prints all powers of 2 from 20 up to 220.
Output Segment
1
2
4
8
16
:
:
65536
131072
262144
524288
1048576

Write a program with loops that compute the sum of all even digits of an input. (For 

example, if the input is 32677, the sum would be 2 + 6 = 8.)

Sample Run

Enter integer: 32677

Sum of all even digits = 8


Write a program with loops that compute the sum of all odd numbers between a and b 

(inclusive), where a and b are inputs.

Sample Run

Enter the lesser integer: 1

Enter the greater integer: 10

The sum of all odd numbers from 1 to 10 = 25


LATEST TUTORIALS
APPROVED BY CLIENTS