Practice 2 🔨

Task 1 🎯

The number in reverse order

Write a nonnegative integer n in reverse order.

Input

One nonnegative 64-bit integer.

Output

Print the number in reverse order.

🕑 Time limit 1 second

💾 Memory limit 128 MiB

Input example 1

1234

Output example 1

4321

Input example 2

100

Output example 2

001

Task 2 🎯

The number of specified digits

Count the number of digits a in number n.

Input

The first line contains one 32-bit integer number n. Number n can be negative. The second line contains a single digit a.

Output

Print the number of digits a in number n.

🕑 Time limit 1 second

💾 Memory limit 128 MiB

Input example 1

25557
5

Output example 1

3

Input example 2

100
0

Output example 2

2

Task 3 🎯

The sum of the first and the last digits in the number

Find the sum of the first and the last digit of an integer.

Input

One 32-bit number that consists of at least 2 digits. The number can be positive or negative.

Output

Print the sum of the first and the last digit of an integer.

🕑 Time limit 1 second

💾 Memory limit 128 MiB

Input example 1

2345

Output example 1

7

Task 4 🎯

Delete a fragment

Given a string of Latin letters and spaces. Delete in it all characters with indices from n to m inclusive. Indexation starts from 0.

Input

First line contains text consisting of Latin letters and spaces. Second line contains two integers n and m (n ≤ m).

Output

Print the updated string.

🕑 Time limit 1 second

💾 Memory limit 128 MiB

Input example 1

abrakadabra
3 6

Output example 1

abrabra

Input example 2

This is my lovely beautiful house
7 16

Output example 2

This is beautiful house

Task 5 🎯

Length of words

Given text - sequence of words. Find the length of each word.

Input

Text contains sequence of words. The length of each word is no more than 20.

Output

For each word print in one line its length.

🕑 Time limit 1 second

💾 Memory limit 128 MiB

Input example 1

Programming Principles 1

Output example 1

11 10 1

Input example 2

I like C 
very
much

Output example 2

1 4 1 4 4