Smallest chosen word
Practice
3.2 (90 votes)
Algorithms
Greedy algorithms
Problem
89% Success 33259 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
You are given three strings \(s_1\), \(s_2\), and \(s_3\). Let \(x\) be any subsequence of \(s_2\) (\(x\) can be an empty string). The name is in the form of (\(s_1+x+s_3\)), here (\(+\)) means concatenation of strings. You are required to print the lexicographically-smallest string \(s\).
Note: The string contains only lowercase letters.
Input format
- First line: Three numbers denoting the size of \(s_1\), \(s_2\), and \(s_3\) respectively
- Second line: Three strings \(s_1\), \(s_2\), and \(s_3\)
Output format
Print a lexicographically-smallest string.
Constraints
\(|s1|,|s2|,|s3|\le10^5\)
Explanation
Here x is "def "
Code Editor
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
Submissions
Please login to view your submissions
Similar Problems
Points:20
104 votes
Tags:
EasyGreedy Algorithms
Points:20
74 votes
Tags:
AlgorithmsBasics of Greedy AlgorithmsGreedy Algorithms
Points:20
21 votes
Tags:
ApprovedBasic ProgrammingEasyGreedy AlgorithmsOpen
Editorial
Login to unlock the editorial
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