String Matching
Practice
4 (21 votes)
Algorithms
Dynamic programming
Easy
Problem
76% Success 7667 Attempts 30 Points 1s Time Limit 1024MB Memory 1024 KB Max Code

Given a string X formed out of single digit numbers from \(0 - 9\) , you are given a set of digits S and you need to count total substring of string X that contains all the digits in the set S.
Input
First line contains a string as input. Next line contains a number n as input denoting size of set S. Next line contains n space separated integers that denote the distinct integers in the set S.
Output
In the output you have to give total count of substrings of the string X such that they contain all the digits in the set S
Constraints
\(1 \le |X| \le 10^5 \)
\(1 \le n \le 10\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
57 votes
Tags:
ApprovedBit ManipulationCombinatoricsEasyMathOpenReady
Points:30
32 votes
Tags:
ApprovedBit ManipulationDynamic ProgrammingEasyMatchingReady
Points:30
275 votes
Tags:
ApprovedBit ManipulationEasyOpenReady