Friday the 13th, Programmers Day


A. Expecting Trouble
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
?111?1??1
1.0
Output
1.00000
Input
01?10??10000
0.5
Output
0.37500
----------------------------------------------------------------------------------------------------
B. Triskaidekaphobia
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
Output
1
Input
100
Output
13
Input
13
Output
-1
----------------------------------------------------------------------------------------------------
C. Counting Fridays
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2012-01-13
2012-09-13
2012-11-20
2013-09-13
2013-09-20
Output
2
----------------------------------------------------------------------------------------------------
D. Chain Letter
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0111
1011
1101
1110
Output
3
Input
4
0110
1010
1100
0000
Output
0
Input
4
0101
1001
0001
1110
Output
2
----------------------------------------------------------------------------------------------------
E. Black Cat Rush
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1 5 4
0 3
4 -4
7 0
-2 -2
Output
3
Input
10 5 3 4
7 5
5 2
10 -7
15 0
Output
3
----------------------------------------------------------------------------------------------------
F. Superstitions Inspection
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
Ukraine
* Friday the   13th
* black   cat
* knock the   wood
USA
* wishing well
* friday   the   13th
Holland
France
* Wishing Well
Output
friday the 13th 
wishing well 
Input
Spain
* Tuesday the 13th
Italy
* Friday the 17th
Russia
* Friday the 13th
England
* rabbit foot
Output
friday the 13th 
friday the 17th 
rabbit foot 
tuesday the 13th 
----------------------------------------------------------------------------------------------------
G. Suffix Subgroup
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
bb
bb
b
aaa
aa
z
Output
3
----------------------------------------------------------------------------------------------------
