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;
}
#include <bits/stdc++.h>
using namespace std;
string st;
int d,i,dem;
int main()
{
getline(cin,st);
d=st.length();
dem=0;
for (i=0; i<=d-1; i++)
if ((97<=st[i] && st[i]<=122) and (st[i]!=".")) dem++;
cout<<dem;
return 0;
}
uses crt;
var st,s:string;
i,d,dem,kt,j,dem1:integer;
begin
clrscr;
write('Nhap xau:'); readln(s);
writeln('Xau vua nhap la: ',s);
d:=length(s);
for i:=1 to d do
if s[i]=#32 then delete(s,i,1);
dem:=1;
st[1]:=s[1];
for i:=1 to d do
begin
kt:=0;
for j:=1 to dem do
if s[i]=st[j] then kt:=1;
if kt=0 then
begin
inc(dem);
st[dem]:=s[i];
end;
end;
for i:=1 to dem do
begin
dem1:=0;
for j:=1 to d do
if st[i]=s[j] then inc(dem1);
writeln(st[i],' xuat hien ',dem1,' lan');
end;
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.
Program HOC24;
var i,d1,d2: byte;
st1,st2: string[60];
begin
write('Nhap xau st1: '); readln(st1);
//---------------Câu 1-------------------
d1:=0; d2:=0;
for i:=1 to length(st1) do
begin
if st1[i]='A' then d1:=d1+1;
if st1[i]='a' then d2:=d2+1;
end;
writeln('Co ',d1,' ki tu A trong xau');
writeln('Co ',d2,' ki tu a trong xau');
//---------------------- Câu 2 --------------------
st2:='';
for i:=1 to length(st1) do if st1[i] in ['a'..'z'] then st2:=st2+st1[i];
writeln('Xau st2 la: ',st2);
//------------------------------Câu 3--------------------
for i:=1 to length(st1) do st1[i]:=upcase(st1[i]);
write('Xau st1 sau khi in hoa la: ',st1);
//--------------------------------------------------------
readln
end.
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.
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.
Giúp mk với mai mk phải nộp r
Program HOC24;
var s: string;
i,d: byte;
begin
write('Nhap xau: '); readln(s);
d:=0;
for i:=1 to length(s) do if (s[i]='b') or (s[i]='B') then d:=d+1;
write('Co ',d,' ki tu B trong xau');
readln
end.