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.
uses crt;
var st:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
dem:=0;
for i:=1 to d do
if (st[i] in ['a'..'z']) or (st[i] in ['A'..'Z']) then inc(dem);
writeln(dem);
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.
Var a: string;
i, Dem: integer;
Begin
writeln(‘nhap xau:’);
Readln(a);
Dem:=0;
For i:=1 to length(a) do
If (‘a’<=a[i]) and (a[i]<=’z’)
Dem:= Dem+1;
Writeln(Dem);
Readln
End.
Var a: string;
i, Dem: integer;
Begin
writeln(‘nhap xau:’);
Readln(a);
Dem:=0;
For i:=1 to length(a) do
If (‘A’<=a[i]) and (a[i]<=’Z’) then
Dem:= Dem+1;
Writeln(Dem);
Readln
End.
uses crt;
var s:string;
i,tong,x,code:integer;
f,g:text;
k:boolean;
const fi='XAU.INP';
fo='XAU.OUT';
begin
k:=false;
assign(f,fi); reset(f);
assign(g,fo); rewrite(g);
readln(f,s);
tong:=0;
for i:=1 to length(s) do
begin
if s[i] in ['0'..'9'] then
begin
k:=true;
val(s[i],x,code);
tong:=tong+x;
x:=0;
cod:=0;
end;
end;
if k=false then writeln(g,'Sai yeu cau')
else
begin
writeln(g,s);
writeln(g,tong);
end;
close(f);
close(g);
end.
#include <bits/stdc++.h>
using namespace std;
string st;
int d,i;
int main()
{
getline(cin,st);
d=st.length();
for (i=0; i<d; i++)
if ((int(st[i])>=48) and (int(st[i])<=57)) cout<<st[i]<<" ";
cout<<endl;
for (i=0; i<=d-1; i++)
if ((int(st[i])>=48) and (int(st[i])<=57)) cout<<i<<" ";
return 0;
}