cf/mirror

Substring

CF
919D1700· expert3s256 MB⌨ stdin/stdout

Examples

Sample 1of 3
Input
5 4
abaca
1 2
1 3
3 4
4 5
Output
3
Sample 2of 3
Input
6 6
xzyabc
1 2
3 1
2 3
5 4
4 3
6 4
Output
-1
Sample 3of 3
Input
10 14
xzyzyzyzqx
1 2
2 4
3 5
4 5
2 6
6 8
6 5
2 10
3 9
10 9
4 6
1 10
2 8
3 7
Output
4
919D.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…