Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4. _Bool is_first = 1;
  5. _Bool word = 0;
  6. char A = 'A';
  7. char Z = 'Z';
  8. char a = 'a';
  9. char z = 'z';
  10. char zero = '0';
  11. char nine = '9';
  12. char lower_bound = '_';
  13. char read = ' ';
  14. long result = 0;
  15. while (1)
  16. {
  17. read = getchar();
  18. if (read == EOF)
  19. {
  20. printf("\n");
  21. break;
  22. }
  23. if (read == ' ')
  24. {
  25. is_first = 1;
  26. result += word;
  27. word = 0;
  28. continue;
  29. }
  30. if (is_first == 1 && (read == '_' || (read - a >= 0 && z - read >=0) || (read - A >=0 && Z - read >= 0)))
  31. {
  32. is_first = 0;
  33. word = 1;
  34. }
  35. else if (is_first == 0 && (read == '_' || (read - a >= 0 && z - read >=0) || (read - A >=0 && Z - read >= 0) ||
  36. (read - zero >= 0 && nine - read >= 0)))
  37. continue;
  38. else
  39. {
  40. word = 0;
  41. is_first = 0;
  42. }
  43. }
  44. printf ("ответ равен %ld\n", result);
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement