Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
check if concatinated string obtained after reversing s1 and s2 both is a palindrome or not
declare str1 varchar2(100) := 'abca'; str2 varchar2(100) := 'cba'; str varchar2(100); i int; j int; cnt int:=0; BEGIN --str:=str1||str2; for i in reverse 1.. length(str1) loop str:=str|| substr(str1,i,1); end loop; str1:=str; str:=''; for i in reverse 1.. length(str2) loop str:=str|| substr(str2,i,1); end loop; str2:=str; str:=str1||str2; --dbms_output.put_line(str1||' '|| str2||' '||str); i:=1; j:=length(str); while i<j loop if substr(str,i,1) != substr(str,j,1) then cnt:=cnt+1; end if; i:=i+1; j:=j-1; end loop; if cnt = 0 then dbms_output.put_line('A palindrome'); else dbms_output.put_line('minimum number of character replacements required is '|| cnt); end if; END;
run
|
edit
|
history
|
help
0
SQLWithOuterAndInnerLoop_UnableToExecute
admt
Srinivas
create table employees as e. No, e. Name., e. Phone no, e. Salary
Character inception test
ishu
sss
Bcom
Srinivas
mr