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.
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.
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.
#include <bits/stdc++.h>
using namespace std;
string s;
int d,i,dem;
int main()
{
cin>>s;
d=s.length();
dem=0;
for (i=0; i<=d-1; i++)
if (s[i]=='a') dem++;
cout<<dem;
return 0;
}
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.
program stringManipulation;
var
st1, st2: string;
countN, i: integer;
begin
write('Nhap vao xau ki tu st1: ');
readln(st1);
countN := 0;
for i := 1 to length(st1) do
begin
if (st1[i] = 'N') or (st1[i] = 'n') then
begin
countN := countN + 1;
end;
end;
writeln('So ky tu N va n trong xau st1 la: ', countN);
st2 := '';
for i := 1 to length(st1) do
begin
if (st1[i] >= 'A') and (st1[i] <= 'Z') then
begin
st2 := st2 + st1[i];
end;
end;
writeln('Cac ky tu in hoa trong xau st1 la: ', st2);
write('Xau st1 viet theo chieu nguoc lai la: ');
for i := length(st1) downto 1 do
begin
write(st1[i]);
end;
readln;
end.
st1 = input("Nhập vào xâu kí tự: ")
count_n = 0
st2 = ""
for char in st1:
if char == 'N' or char == 'n':
count_n += 1
if char.isupper():
st2 += char
print("Số lần xuất hiện của kí tự 'N' và 'n' là:", count_n)
print("Xâu kí tự chỉ chứa kí tự in hoa là:", st2)
print("Xâu kí tự đảo ngược là:", st1[::-1])
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.
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.