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.
string = input("Nhập vào một xâu kí tự: ")
count = string.count('tiền')
print('Xâu kí tự có ', count, 'từ "tiền"')
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.
Bài 2:
#include <bits/stdc++.h>
using namespace std;
string st;
int d;
int main()
{
getline(cin,st);
d=st.length();
cout<<d;
return 0;
}
Bài 1:
Var so,i,n,dem:integer;
Begin
Write('Nhap so luong so n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i);readln(so);
If so mod 2 = 0 then dem:=dem+1;
End;
Write('Co ',dem,' so chan');
Readln;
End.
Bài 2:
Var st:string;
Begin
Write('Nhap vao xau ki tu ');readln(st);
Write(' Xau vua nhap co do dai la ',length(st));
Readln;
End.
Var st:string;
i,dem:integer;
Begin
Write('Nhap xau ky tu ');readln(st);
For i:=1 to length(st) do
If st[i] = 'a' then dem:=dem+1;
Write('So ky tu a co trong xau la ',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.
Var a: string;
i, Dem: integer;
Begin
writeln(‘nhap xau:’);
Readln(a);
Dem:=0;
For i:=1 to length(a) do
If a[i] =’ ‘ then
Dem:= Dem+1;
Writeln(Dem);
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.
Program HOC24;
var s: string;
i,d: byte;
begin
write('Nhap xau: '); readln(s);
while s[1]=#32 do delete(s,1,1);
while length(s)=#32 do delete(s,length(s),1);
while pos(#32#32,s)<>0 do delete(s,pos(#32#32,s),1);
d:=0;
for i:=1 to length(s) do if s[i]=#32 then d:=d+1;
write('Trong xau co ',d+1, ' tu');
readln
end.