cho một xâu ký tự chứa dấu cách trống trong tệp BT.INP. Ghi kết quả đếm các dấu cách trống trong xâu vào tệp BT.OUT
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 HOC24;
const fi='DL.INP';
fo='DL.OUT';
var s: string;
d,i: byte;
f: text;
procedure ip;
begin
assign(f,fi);
reset(f);
read(f,s);
close(f);
end;
procedure out;
begin
assign(f,fo);
rewrite(f);
d:=0;
for i:=1 to length(s) do if s[i] in ['0'..'9'] then inc(d);
write(f,d);
close(f);
end;
begin
ip;
out;
end.
const fi='dl.inp';
fo='kq.out';
var f1,f2:text;
s:string;
d,i,dem:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,s);
d:=length(s);
dem:=0;
for i:=1 to d do
if s[i] in ['0'..'9'] then inc(dem);
writeln(dem);
readln;
end.
const fi='demxau.inp',
fo='demxau.out';
var f1,f2:text;
st:string;
d,i,dem:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,st);
d:=length(st);
dem:=0;
for i:=1 to d do
if st[i]=' ' then dem:=dem+1;
writeln(f2,dem+1);
close(f1);
close(f2);
end.
const fi='input.txt';
fo='output.txt';
var f1,f2:text;
st:string[125];
a:array[1..125]of string;
i,d,dem,kt,j:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,st);
d:=length(st);
dem:=1;
a[1]:=st[1];
for i:=1 to d do
begin
kt:=0;
for j:=1 to dem do
if a[j]=st[i] 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(f2,a[i],' xuat hien ',dem1,' lan');
end;
close(f1);
close(f2);
end.
uses crt;
const fi='songuyen.inp';
fo='songuyen2.out';
var a:array[1..100]of integer;
i,n,t1:integer;
f1,f2:text;
begin
clrscr;
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
for i:=1 to n do readln(f1,a[i]);
t1:=0;
for i:=1 to n do if a[i] mod 2<>0 then t1:=t1+a[i];
writeln(t1);
writeln(f2,t1);
for i:=1 to n do
if a[i] mod 2<>0 then write(a[i]:4);
close(f1);
close(f2);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int d,i,d1;
string st;
int main()
{
getline(cin,st);
d=st.length();
while (st[0]==32)
{
st.erase(0,1);
}
while (st[d-1]==32)
{
st.erase(d-1,1);
}
d1=st.length();
for (i=0; i<d1; i++)
if ((st[i]==32) && st[i+1]==32)
{
st.erase(i,1);
i--;
}
cout<<st;
return 0;
}
const fi='xau.inp';
fo='xau.out';
var f1,f2:text;
a:array[1..100]of string;
i,d:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eof(f1) do
begin
n:=n+1;
readln(f1,a[n]);
end;
for i:=1 to n do
begin
for j:=1 to length(a[i]) do
a[i][j]:=upcase(a[i][j]);
end;
for i:=1 to n do
writeln(f2,length(a[i]),' ',a[i]);
close(f1);
close(f2);
end.
const fi='bt.inp';
fo='bt.out';
var f1,f2:text;
st:string;
i,d,dem:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,st);
d:=length(st);
dem:=0;
for i:=1 to d do
if st[i]=#32 then inc(dem);
writeln(f2,dem);
close(f1);
close(f2);
end.