Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char s[1002], word[100];
- int i, j, length, I_W_S;
- gets(s);
- length = strlen(s);
- I_W_S = 0;
- for(i = 0, j = 0; i < length; i++) {
- if(s[i] >= 'a' && s[i] <= 'z') {
- if(I_W_S == 0) {
- I_W_S = 1;
- word[j] = 'A' + s[i] - 'a';
- j++;
- }
- else {
- word[j] = s[i];
- j++;
- }
- }
- else if(s[i] >= 'A' && s[i] <= 'Z' || s[i] >= '0' && s[i] <= '9') {
- if(I_W_S == 0) {
- I_W_S = 1;
- }
- word[j] = s[i];
- j++;
- }
- else {
- if(I_W_S == 1) {
- I_W_S = 0;
- word[j] = '\0';
- printf("%s\n", word);
- j = 0;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement