{"id":"ffdf50b0-c68b-41b9-9e9a-263806c42026","name":"Regular Expression Matching","description":"1. You are given two strings S1 and S2. S1 represents a text and S2 represents a pattern.\r\n2. You have to print 'true' if the pattern is matched with the given text, otherwise print 'false'.\r\n\r\nThe pattern can include the characters '.' and '*'\r\n'.' - matches any single character\r\n'*' - matches zero or more of the preceding character","inputFormat":"2 strings S1 and S2","outputFormat":"true or false as required","constraints":"1 < length of strings S1 amd S2 <= 200","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n\tpublic static boolean solution(String s, String p) {\r\n\t\t//write your code here\r\n\t\t\r\n\t\treturn false;\r\n\t}\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner scn = new Scanner(System.in);\r\n\t\tString s1 = scn.next();\r\n\t\tString s2 = scn.next();\r\n\t\tSystem.out.println(solution(s1,s2));\r\n\t}\r\n\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"hard","sampleInput":"aa\r\na","sampleOutput":"false\r\n","questionVideo":"https://www.youtube.com/embed/DJvw8jCmxUU?end=73","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"5539a6e8-c8bf-4f04-805c-e43e9d20e72a","name":"Dynamic Programming For Intermediate","slug":"dynamic-programming-for-intermediate-408","type":0},{"id":"89663799-b78a-4889-bbb4-09acfa878183","name":"Regular Expression Matching","slug":"regular-expression-matching","type":1}],"next":{"id":"8d644454-290f-42f5-8490-ff70ab22c60c","name":"Regular expression matching MCQ","type":0,"slug":"regular-expression-matching-mcq"},"prev":{"id":"630f6612-61bf-4ca4-9ab5-8a11d2d94ae8","name":"WILDCARD PATTERN MATCHING","type":3,"slug":"wildcard-pattern-matching"}}}

Regular Expression Matching

1. You are given two strings S1 and S2. S1 represents a text and S2 represents a pattern. 2. You have to print 'true' if the pattern is matched with the given text, otherwise print 'false'. The pattern can include the characters '.' and '*' '.' - matches any single character '*' - matches zero or more of the preceding character

{"id":"ffdf50b0-c68b-41b9-9e9a-263806c42026","name":"Regular Expression Matching","description":"1. You are given two strings S1 and S2. S1 represents a text and S2 represents a pattern.\r\n2. You have to print 'true' if the pattern is matched with the given text, otherwise print 'false'.\r\n\r\nThe pattern can include the characters '.' and '*'\r\n'.' - matches any single character\r\n'*' - matches zero or more of the preceding character","inputFormat":"2 strings S1 and S2","outputFormat":"true or false as required","constraints":"1 < length of strings S1 amd S2 <= 200","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n\tpublic static boolean solution(String s, String p) {\r\n\t\t//write your code here\r\n\t\t\r\n\t\treturn false;\r\n\t}\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner scn = new Scanner(System.in);\r\n\t\tString s1 = scn.next();\r\n\t\tString s2 = scn.next();\r\n\t\tSystem.out.println(solution(s1,s2));\r\n\t}\r\n\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"hard","sampleInput":"aa\r\na","sampleOutput":"false\r\n","questionVideo":"https://www.youtube.com/embed/DJvw8jCmxUU?end=73","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"5539a6e8-c8bf-4f04-805c-e43e9d20e72a","name":"Dynamic Programming For Intermediate","slug":"dynamic-programming-for-intermediate-408","type":0},{"id":"89663799-b78a-4889-bbb4-09acfa878183","name":"Regular Expression Matching","slug":"regular-expression-matching","type":1}],"next":{"id":"8d644454-290f-42f5-8490-ff70ab22c60c","name":"Regular expression matching MCQ","type":0,"slug":"regular-expression-matching-mcq"},"prev":{"id":"630f6612-61bf-4ca4-9ab5-8a11d2d94ae8","name":"WILDCARD PATTERN MATCHING","type":3,"slug":"wildcard-pattern-matching"}}}
plane

Editor


Loading...

Regular Expression Matching

hard

1. You are given two strings S1 and S2. S1 represents a text and S2 represents a pattern. 2. You have to print 'true' if the pattern is matched with the given text, otherwise print 'false'. The pattern can include the characters '.' and '*' '.' - matches any single character '*' - matches zero or more of the preceding character

Constraints

1 < length of strings S1 amd S2 <= 200

Format

Input

2 strings S1 and S2

Output

true or false as required

Example

Sample Input

aa a

Sample Output

false

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode