Remove all Non-Alphanumeric Characters
Single File Programming Question
Problem Statement
Alex needs to clean up user inputs by removing all non-alphanumeric characters while preserving the remaining characters in their original order. Write a program using java.lang.StringBuilder to accomplish this task.
Input:
format :The input consists of a single line containing a string with alphanumeric and non-alphanumeric characters.
Output:
format :The output prints a single line without space containing the cleaned string with all non-alphanumeric characters removed, preserving the order of the remaining characters.
Refer to the sample output for formatting specifications.
Code constraints : The given test cases fall under the following constraints:
The input string consists of printable ASCII characters.
Sample test cases :
Input 1:
Hello, World! 123
Output 1 :
HelloWorld123
Input 2 :
@Java_Programming!! 2024
Output 2 :
JavaProgramming2024