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.
2:
uses crt;
var st:string;
d,i,dem1,dem2:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
dem1:=0;
dem2:=0;
for i:=1 to d do
begin
if st[i] in ['0'..'9'] then inc(dem1);
if (st[i] in ['a'..'z']) or (st[i] in ['A'..'Z']) then inc(dem2);
end;
writeln('So ki tu la chu so la: ',dem1);
writeln('So ki tu la chu cai la: ',dem2);
for i:=1 to d do
if st[i] in ['0'..'9'] then delete(st,i,1);
writeln('Xau sau khi xoa cac chu so la: ',st);
readln;
end.
Program HOC24;
var s: string;
x: char;
d: byte;
begin
write('Nhap xau: '); readln(s);
write('Nhap ki tu: '); readln(x);
d:=0;
for i:=1 to length(s) do if s[i]=x then d:=d+1;
if d=0 then write('Ki tu do khong xuat hien trong xau') else write('Ki tu do xuat hien trong xau');
readln
end.
uses crt;
var st:string;
dem,i,d:integer;
begin
clrscr;
readln(st);
dem:=0;
d:=length(st);
for i:=1 to d do
if st[i]=' ' then inc(dem);
write(dem);
readln;
end.
uses crt;
var st:string;
d,i:integer;
begin
clrscr;
readln(st);
d:=length(st);
for i:=1 to d do
if not (st[i] in ['0'..'9']) then write(st[i]);
readln;
end.
uses crt;
var st:string;
a:array[1..255]of string;
i,d,dem,kt,j,dem1:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
a[1]:=st[1];
dem:=1;
for i:=1 to d do
begin
kt:=0;
for j:=1 to dem do
if st[i]=a[j] then kt:=1;
if kt=0 then
begin
inc(dem);
a[dem]:=st[i];
end;
end;
for i:=1 to dem do
begin
dem1:=0;
for j:=1 to d do
if a[i]=st[j] then inc(dem1);
writeln(a[i],' xuat hien ',dem1,' lan');
end;
readln;
end.
uses crt;
var a:string;
c:char;
i,dem:integer;
begin
clrscr;
readln(a);
readln(c);
dem:=0;
for i:=1 to length(a) do
if a[i]=c then dem:=dem+1;
writeln(dem);
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;
}
uses crt;
var st:string;
n,vt,d,i:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
write('Nhap vi tri can xoa:'); readln(vt);
write('Nhap so ki tu can xoa:'); readln(n);
delete(st,vt,n);
writeln('Xau sau khi xoa la: ',st);
readln;
end.
Bài 3:
uses crt;
const fi='teptong.txt';
var a,b:integer;
f1:text;
begin
clrscr;
assign(f1,fi); rewrite(f1);
readln(a,b);
writeln(a+b);
writeln(f1,a+b);
close(f1);
readln;
end.
Program HOC24;
var i,d: byte;
s: string;
begin
write('Nhap xau: '); readln(s);
d:=0;
for i:=1 to length(s) do if s[i] in ['0'..'9'] then d:=d+1;
write('Co ',d,' ki tu so trong xau');
readln
end.