Programmer's school

Forgot password?
[problems] [status] [courses] [info] [register]
Login:   Password:    

Substring Search

(Time limit: 0,2 sec. Memory limit: 16 MB Difficulty: 38%)

Find all occurrences of the string P in the string T.

Input

The first line of input contains the string T, the second line of input contains the string P. Both strings consist of English letters only. The lengths of the strings are 1 to 5×104 inclusive.

Output

Output all zero-based positions of the string P in the string T in ascending order.

Sample

#INPUT.TXTOUTPUT.TXT
1ababbababa
aba
0 5 7

Для отправки решения задачи необходимо зарегистрироваться и авторизоваться!


 C++ programming language
 Solution of olympiad tasks
 Regional competition
 Books by Fyodor Menshikov
 USE in informatics
 Training olympics
 Introduction
 Integer arithmetic
 Sorting algorithms
 Long arithmetic
 C++ Standard Template Library
 Dynamic programming
 Combinatorics
 Computational geometry
 String
 Data structures
 Graph theory - 1
 Graph theory - 2
 Simple tasks
 Algorithms on strings
 Polynomial hash
 A. Antipalindrom
 B. Prefiks-funktsiya
 C. Z-funktsiya
 D. Pole chudes
 E. Poisk podstroki
 F. Sdvig teksta
 G. Tsiklicheskaya stroka
 H. Suffiksy
 I. Kolichestvo razlichnyh podstrok
 J. Dendrohronologiya
 K. Abracadabra
 L. Algoritm Manakera

Krasnoyarsk regional Palace of pioneers, (c)2006 - 2025, ИНН 246305493507, E-mail: admin@acmp.ru