Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int count1 = 0, count2 = 0, count3 = 0, number = 0, flag = 0, counter = 0;
- char current , previous = 'c';
- while ((current = getchar()) != '@')
- {
- printf("%c\n", current);
- if (('1' <= current) && (current <= '9'))
- {
- flag = 1;
- counter = 0;
- number = current - 48;
- }
- else
- {
- if ((('0' > previous) && (previous >= '9')) && flag ==1 && current-previous ==1)
- {
- counter++;
- }
- if ((('0' > previous) && (previous >= '9')) && current-previous !=1)
- {
- flag = 0;
- }
- printf("%d\n", flag);
- if (('0' < previous) && (previous <= '9'))
- {
- counter = 1;
- }
- if ((counter == number) && (flag = 1))
- {
- count2 += number;
- count1++;
- }
- }
- previous = current;
- }
- printf("%d\n%d\n%d\n", count1, count2, count3);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement