Hexaware| 2022 | Coding Round | OA | String Modification: Restricting Consecutive Character Repeats
Hexaware · Question · Posted Apr 2026
Problem Statement You are given a string s. Your task is to modify and print the given string s in such a way that adjacent characters in the string don't repeat themselves more than twice. The Rule: If a character appears more than two times in a row, any occurrences after the second one must be removed from the final output. Example Walkthrough Example 1: Input: abbbccdeab Analysis: a: Appears once. Keep. bbb: Character 'b' appears three times consecutively. We ...
The full answer & interview discussion are available to premium members.
Log in Create a free account