Super Reduced String

Solutions A solution changes the string by removing same adjacent elements. Here is a C++ implementation: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #include <string> #include <iostream> #include <algorithm> using namespace std; int main() { string S; cin >> S; auto finder = [&]{ return adjacent_find(begin(S), end(S)); }; for (auto adjFind = finder(); adjFind != end(S); adjFind = finder()) { S. [Read More]

The Product Name

Solutions Basically, each character \(out_i\) of the output string \(out\) occurs the least number of times at index \(i\) among all the input strings. We can count the occurrences of each letter of the alphabet (26) for each position of the input strings. Since all the strings have \(5\) characters, we have \(5\) frequency tables. Thus, we use constant additional storage - for instance, an array containing 5 arrays of 26 integers. [Read More]