Company: Bank of Australia
Difficulty: medium
String Rearrangement Pattern Problem Description You are given a string (str) where the characters have to be rearranged according to a specific pattern. The pattern is not given; only some examples that follow the pattern are provided. Your task is to analyze the provided examples, identify the pattern, and write a program that applies the same rearrangement to any given input string. Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings anywhere in the program, as these contribute to the standard output, and test cases will fail. Input Format: The only line of input should contain a string, str, which needs to be rearranged. Output Format: The only line of output should display the rearranged string. #include <iostream> #include <string> using namespace std; string printResult(string str1) { // str1 is given input string. string res = ""; // WRITE YOUR CODE HERE. return res; } int main() { string str1; getline(cin, str1); string res = pr