You are hereProgramming Problems / 2011 Programming Problems2

# 2011 Programming Problems2

By - Posted on 27 April 2012

## Word Turn

Description
Charlie likes rotating words. He does this by rotating a word a certain distance. For example, to rotate the word “Charlie” by 1 results in “eCharli”. Rotating it two more times gives you “lieChar”. You are to write a program which will help Charlie.
Input
The first line contains the word (which will have fewer than 16 letters). The second line contains an integer n, which will be less than the length of the word. You must rotate the word n times.
Output
The output will be the rotated word.

Example 1
Input

```​Charlie
3```

Output

`​lieChar`

Example 2
Input

```​Competition
1```

Output

`​nCompetitio`

## Prime Numbers

Description
Mr. Prime loves prime numbers and wants to find out how many prime numbers are in a particular range of numbers. For example, between the numbers 4 and 12, there are 3 primes: 5, 7 and 11. Mr. Prime is an inclusive guy, so if asked for the number of primes between 5 and 11, he would give the same answer.
Note that  a prime number is a number greater than or equal to 2 which is only divisible by itself and 1. The first 5 primes are: 2, 3, 5, 7, 11.
Input
The input will be an integer N, (0 <= N <= 999999) on one line and another integer, M, (N <= M <= 1000000).
Output
The output will be the number of primes between N and M, including M and N.

Example 1
Input

```4
12```

Output

`​3`

Example 2
Input

```​1
20```

Output

`​8`

## Prime substrings

Description
A substring of an integer is formed from a subsequence of consecutive digits of the original integer. For example, the number 2478 contains the substrings 2478, 247, 478, 24, 47, 78, 2, 4, 7 and 8. You must find the largest integer substring which is also a prime.
Input
The input will be an integer N, (0 <= N <= 1000000000).
Output
The output will be the largest prime substring of N. If none of the substrings are prime, then output “No Primes”

Example 1
Input

2319

Output
`31`
Example 2
Input
`2486`
Output
`No Primes`