Smallest chosen word
Practice
3.2 (90 votes)
Algorithms
Greedy algorithms
Problem
89% Success 33258 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\)
Submissions
Please login to view your submissions
Similar Problems
Points:20
105 votes
Tags:
ApprovedBasic ProgrammingBrute-force searchEasyReady
Points:20
28 votes
Tags:
ApprovedBasic ProgrammingEasyOpenSorting
Points:20
36 votes
Tags:
Greedy algorithmAlgorithmsBasics of Greedy AlgorithmsGreedy Algorithms
Editorial