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\)
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
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
22 votes
Tags:
AlgorithmsGreedy Algorithms
2.Swap Sum
Points:20
23 votes
Tags:
Basics of Greedy AlgorithmsAlgorithmsGreedy Algorithms
Points:20
322 votes
Tags:
Ad-HocEasyGreedy Algorithms
Editorial
Login to unlock the editorial