Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
Bài 1:
uses crt;
var S:String;
vt:integer;
begin
clrscr;
Write(‘Nhap 1 xau:’); Readln(S);
While pos(‘nang’,s)>0 do
Begin
Vt:= pos(‘nang’,s);
Delete(s,vt,4);
Insert(‘mua’,s ,vt);
End;
Writeln(‘Xau sau khi thay the ’,s);
Readln;
End.
Bài 2:
uses crt;
var st:string;
d,i,kt:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
kt:=0;
for i:=1 to d do
if st[i]<>st[d-i+1] then kt:=1;
if kt=0 then writeln(st,' la xau doi xung')
else writeln(st,' khong la xau doi xung');
readln;
end.
uses crt;
var st:string;
i,d:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
writeln('Xau vua nhap la: ',st);
for i:=1 to d do
if st[i]=#32 then delete(st,i,1);
writeln('Xau moi la: ',st);
readln;
end.
uses crt;
var st:string;
begin
clrscr;
write('Nhap xau st:'); readln(st);
delete(st,3,4);
writeln('Xau sau khi xoa la: ',st);
readln;
end.
program bai1;
uses crt;
var i:integer;
s,s1:string;
begin
clrscr;
write('nhap S:');readln(s);
while pos('C',s)<>0 do
begin
insert('LOP11A',s,pos('C',s));
delete(s,pos('C',s),1);
end;
writeln('xau sau khi bien doi la: ',s);
writeln('do dai cua xau tren la: ',length(s));
write('nhap s1:');readln(s1);
if s1[1]=s[1] then writeln('ki tu dau cua hai xau trung nhau')
else writeln('ki tu dau cua hai xau khong trung nhau');
readln;
end.
uses crt;
const fi='vb.txt';
var f1:text;
st:string;
i,d:integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
readln(st);
d:=length(st);
for i:=1 to d do
if st[i] in ['A'..'Z'] then write(f1,st[i]:4);
close(f1);
readln;
end.
uses crt;
var s:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau S:'); readln(s);
d:=length(s);
writeln('Cac ki tu so co trong xau S:');
dem:=0;
for i:=1 to d do
if s[i] in ['0'..'9'] then
begin
write(s[i]:4);
inc(dem);
end;
writeln;
writeln('So ki tu chu so co trong xau S: ',dem);
for i:=1 to d do
if s[i] in ['0'..'9'] then s[i]:='A';
writeln('Xau sau khi doi la: ',s);
readln;
end.
Program HOC24;
var S: string;
d,i: byte;
begin
write('S= '); readln(s);
For i:= length(s) downto 1 do write(s[i]);
writeln;
while s[length(s)]=#32 do delete(s,length(s),1);
while pos(#32#32,s)<>0 do delete(s,pos(#32#32,s),1);
while s[1]=#32 do delete(s,1,1);
d:=0;
for i:=1 to length(s) do d:=d+1;
write('So tu :',d);
readln
end.
uses crt;
var s:string[200];
i,d,dem:integer;
begin
clrscr;
write('Nhap xau:'); readln(s);
d:=length(s);
write('Xau viet theo chieu nguoc la: ');
for i:=d downto 1 do
write(st[i]);
writeln;
dem:=0;
for i:=1 to d do
if st[i]=#32 then inc(dem);
writeln('So tu la: ',dem);
readln;
end.
Program HOC24;
var s: string;
i: byte;
begin
write('Nhap xau :'); readln(s);
for i:=1 to length(s) do if s[i]<>'a' then write(s[i]);
readln
end.
uses crt;
var st:string;
i,d:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if st[i]='a' then delete(st,i,1);
writeln(st);
readln;
end.