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.
program XoaSoLienTuc;
uses sysutils;
function XoaSoLienTuc(S: string): string;
var
i: integer;
result: string;
begin
result := '';
for i := 1 to Length(S) do
begin
if not (S[i] in ['0'..'9']) then
begin
if (i = 1) or (S[i-1] in ['0'..'9']) then
result := result + ' ';
result := result + S[i];
end;
end;
result := Trim(result);
result := StringReplace(result, ' ', '', [rfReplaceAll]);
XoaSoLienTuc := result;
end;
var
S: string;
begin
write('Nhập vào xâu S: ');
readln(S);
writeln('Kết quả: ', XoaSoLienTuc(S));
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.
uses crt;
var s:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau S:'); readln(s);
d:=length(s);
writeln('Cac ki tu so co trong xau S:');
dem:=0;
for i:=1 to d do
if s[i] in ['0'..'9'] then
begin
write(s[i]:4);
inc(dem);
end;
writeln;
writeln('So ki tu chu so co trong xau S: ',dem);
for i:=1 to d do
if s[i] in ['0'..'9'] then s[i]:='A';
writeln('Xau sau khi doi la: ',s);
readln;
end.
uses crt;
var s:string;
dem,i,d:integer;
begin
clrscr;
write('Nhap xau:'); readln(s);
d:=length(s);
dem:=0;
for i:=1 to d do
if (s[i] in ['A'..'Z']) or (s[i] in ['a'..'z']) then inc(dem);
writeln(dem);
readln;
end.
program bai1;
uses crt;
var i:integer;
s,s1:string;
begin
clrscr;
write('nhap S:');readln(s);
while pos('C',s)<>0 do
begin
insert('LOP11A',s,pos('C',s));
delete(s,pos('C',s),1);
end;
writeln('xau sau khi bien doi la: ',s);
writeln('do dai cua xau tren la: ',length(s));
write('nhap s1:');readln(s1);
if s1[1]=s[1] then writeln('ki tu dau cua hai xau trung nhau')
else writeln('ki tu dau cua hai xau khong trung nhau');
readln;
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-1; i++)
if (48<=st[i] && st[i]<=57) st.erase(i,1);
cout<<st;
return 0;
}
có test mẫu ko bạn ??