Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- using namespace std;
- int main() {
- char str[255];
- int charAnt = 0;
- int cifre = 0, numere = 0;
- std::cin >> str;
- for (int i = 0; i < strlen(str); i++) {
- if (i == 0)
- if (isdigit(str[i]) > 0) {
- cifre++;
- charAnt++;
- }
- else {
- if (isdigit(str[i - 1]) > 0)
- {
- cifre++;
- charAnt++;
- }
- else {
- numere++;
- charAnt = 0;
- }
- }
- }
- std::cout << cifre << std::endl << numere;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement