Guest User

Untitled

a guest
Apr 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int cyfry(string x)
  5. {
  6.     int licznik=0;
  7.     for(int i=0; i<x.length(); i++)
  8.     {
  9.         if(x[i]>47 && x[i]<58) licznik++;
  10.     }
  11.     return licznik;
  12. }
  13. int litery(string x)
  14. {
  15.     int licznik=0;
  16.     for(int i=0; i< x.length(); i++)
  17.     {
  18.         if(x[i]>64 && x[i]<91 || x[i]>96 && x[i]<123) licznik++;
  19.     }
  20.     return licznik;
  21. }
  22.  
  23. int main()
  24. {
  25.     int n;
  26.     string x;
  27.     cin >> n;
  28.     cin.get();
  29.     for(int i=0; i<n; i++)
  30.     {
  31.  
  32.         getline(cin, x);
  33.         cout << x.length()  << " " << litery(x) << " " << cyfry(x) << endl;
  34.     }
  35.     return 0;
  36. }
Add Comment
Please, Sign In to add comment