Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int samoglaska(char c) {
- if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
- return 1;
- }
- else {
- return 0;
- }
- }
- int main (int argc, const char * argv[]) {
- int n;
- scanf("%d", &n);
- char prethoden = '0';
- int parovi = 0;
- for(int i = 0; i < n; i++) {
- char c;
- scanf(" %c", &c);
- if(prethoden != '0') {
- if(samoglaska(c)) {
- if(!samoglaska(prethoden)) {
- parovi++;
- }
- }
- else {
- if(samoglaska(prethoden)) {
- parovi++;
- }
- }
- }
- prethoden = c;
- }
- printf("%d\n", parovi);
- return 0;
- }
- // a e о g h a h i o f f a m n
- // rekurzja() = rekurzija() + 0
- // rekruzija() = rekurzija() + 1
- // rekurzija() = rekurzija() + 0
- // rekurzija() = rekurzija() + 0
- // rekurzija() = rekruzija() + 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement