Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- int n, i;
- scanf("%d", &n);
- char s[n];
- scanf("%s", s);
- if(n > 3)
- {
- if(n % 2 == 0)
- {
- for(i = 0; i < n; i += 2)
- {
- printf("%c%c", s[i], s[i+1]);
- if(i == n - 2) break;
- printf("-");
- }
- printf("\n");
- }
- else
- {
- printf("%c%c%c-", s[0], s[1], s[2]);
- for(i = 3; i < n; i += 2)
- {
- printf("%c%c", s[i], s[i+1]);
- if(i == n - 2) break;
- printf("-");
- }
- //printf("%c%c%c", s[n-1], s[n-2], s[n-3]);
- printf("\n");
- }
- }
- else printf("%s\n", s);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement