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.
#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 s:string;
i,d:integer;
begin
clrscr;
write('Nhap xau S:'); readln(s);
d:=length(s);
for i:=1 to d do
if (s[i] in ['a'..'z']) or (s[i] in ['A'..'Z']) then delete(s,i,1);
writeln('Xau sau khi xoa het ki tu chu la: ',s);
readln;
end.
tham khảo
uses crt;
var st:string;
i,d:integer;
begin
clrscr;
readln(st);
d:=length(st);
for i:=1 to d do
if (not (st[i] in ['A'..'Z'])) and (not (st[i] in ['a'..'z'])) then write(st[i]);
readln;
end.
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;
readln(st);
d:=length(st);
for i:=1 to d do
if (not (st[i] in ['A'..'Z'])) and (not (st[i] in ['a'..'z'])) 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.
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.