Remove Character from String Problem Statement
Given a string str
and a character 'X', develop a function to eliminate all instances of 'X' from str
and return the resulting string.
Input:
The first line contains a string without leading or trailing spaces.
The second line contains a character 'X' without leading or trailing spaces.
Output:
The output is a single line displaying the modified string.
Example:
Input:
hello world
o
Output:
hell wrld
Constraints:
0 <= N <= 10^6
, whereN
is the length ofstr
.- Process should complete within 1 second.
Note:
No need to explicitly print anything; assume that all necessary output operations have been handled.
Be the first one to answer
Add answer anonymously...
Top Siemens Software Developer interview questions & answers
Popular interview questions of Software Developer
Top HR questions asked in Siemens Software Developer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app