Những câu hỏi liên quan
dũng
Xem chi tiết
havdgncna
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 5 2022 lúc 23:27

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

readln(st);

d:=length(st);

for i:=1 to d do

  if (st[i] in ['a'..'z']) or (st[i] in ['A'..'Z']) then write(st[i]);

writeln;

for i:=1 to d do 

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

readln;

end.

Bình luận (0)
Chuu
Xem chi tiết
Do Ngoc Thao My
Xem chi tiết
Do Ngoc Thao My
Xem chi tiết
Hai Yen Duong
Xem chi tiết
luc lun
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 12 2021 lúc 23:09

#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;
}

 

Bình luận (1)
Lan Anh
Xem chi tiết
Nguyễn Hạnh
Xem chi tiết
Nguyễn Lê Phước Thịnh
2 tháng 4 2021 lúc 19:21

uses crt;

var s:string;

i,d,dem1,dem2,dem3,dem4:integer;

begin

clrscr;

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

d:=length(s);

dem1:=0;

dem2:=0;

dem3:=0;

dem4:=0;

for i:=1 to d do 

  begin

if st[i] in ['0'..'9'] then inc(dem1)

else if st[i] in ['a'..'z'] then inc(dem2)

else if st[i] in ['A'..'Z'] then inc(dem3)

else inc(dem4);

end;

writeln('So luong ky tu so la: ',dem1);

writeln('So luong ky tu thuong la: ',dem2);

writeln('So luong ky tu hoa la: ',dem3);

writeln('So luong ky tu dac biet la: ',dem4);

readln;

end.

Bình luận (0)