Những câu hỏi liên quan
U Lan
Xem chi tiết
U Lan
Xem chi tiết
U Lan
Xem chi tiết
U Lan
Xem chi tiết
Khánh Mỹ
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 4 2021 lúc 19:21

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.

Bình luận (0)
PGD FF
Xem chi tiết
Harunastu
Xem chi tiết
Minh Lệ
18 tháng 1 2021 lúc 19:40

Program HOC24;

var s: string;

tg,d,max,i: byte;

code: integer;

begin

write('Nhap xau : '); readln(s);

// cau a

for i:=1 to length(s) do if s[i] in ['a'..'z'] then write(upcase(s[i]));

//------

writeln;

//-cau b

for i:=length(s) downto 1 do if s[i] in ['0'..'9'] then write(s[i]);

//------

writeln;

//---cau c

d:=0;

for i:= 1 to length(s) do

if s[i] in ['0'..'9'] then 

begin

val(s[i],tg,code);

if tg>max then max:=tg;

d:=d+1;

end;

if d=0 then write('Khong co chu so trong day') else write('Chu so lon nhat la : ',max);

readln 

end.

Bình luận (1)
Nguyễn Lê Phước Thịnh
18 tháng 1 2021 lúc 21:32

uses crt;

var st,st1:string;

d,i,d1,max,x,y:integer;

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

writeln('Day cac ki tu thuong doi sang chu hoa la: ');

for i:=1 to d do 

  if st[i] in ['a'..'z'] then write(upcase(st[i]):4);

st1:=''

for i:=1 to d do 

  if st[i] in ['0'..'9'] then st1:=st1+st[i];

d1:=length(st1);

for i:=d1 downto 1 do 

  write(st1[i]:4);

writeln;

max:=0;

for i:=1 to d1 do 

  begin

val(st1[i],x,y);

if max<x then max:=x;

end;

writeln('Chu so lon nhat trong xau la: ',max);

readln;

end.

Bình luận (1)
Phạm trọng Thành
Xem chi tiết
Lê Bảo Châu
6 tháng 1 lúc 14:43

#include <bits/stdc++.h>
using namespace std;
int main() {
    string str;
    getline(cin, str);
    string ans = "";
    for (char c : str) {
        if (!isdigit(c)) {
            ans += c;
        }
    }
    cout <<ans;
}

Theo mk là như v

Bình luận (0)

uses crt;

var st:string;

d,i:integer;

begin

clrscr;

readln(st);

d:=length(st);

for i:=1 to d do

if not(st[i] in ['0'..'9']) then write(st[i]);

readln;

end.

Bình luận (0)
Lê Thị Vân Giang
Xem chi tiết