I'm trying to write a code which has a string with a special character ","
in it. It can have either one occurrence or multiple occurrences.
Now what I want to do is I want to replace every special character with characters [a-z]
. Every single special character should be replaced with every character with characters [a-z]
.
After everytime the special characters are all replaced I will check the string for a property, if it satisfies that property, the program should terminate and the string will be returned.
For example take input as : hello,,how
I want to replace first ","
with 'a'
and second ","
with 'a'
first and then with a,b
then with a,c ..... a,z
till z,a......z,z
. (If in this process a string turns out to obey my required property, that string will be returned)
The above example hello,,how would produce these strings - hellowaahow , hellowabhow, hellowachow..... hellowazhow, ...... hellozahow,hellowzbhow, hellozchow......hellozzhow. If any time in this process a string satisfies a property that string will be returned and program will exit
I don't even have an idea how to approach this problem, can anyone help me out with an efficient technique?
,
? – Sanket Makanihelloa,how
, then replace second "," with 'a' first and then with a,b which will givehelloaaa,bhow
. That just seems wrong, so please show what you expect, and maybe also what you expect for 3 or 4 commas. – Andreas