1 solutions

  • 0
    @ 2025-11-5 19:40:56

    C :

    #include <stdio.h>
    #include <string.h>
    
    int main()
    {
    	int i, j = 0;
    	char s[80], ns[80];
    	gets(s);
    	for (i = 0; i < strlen(s); i++)
    	{
    		if ((s[i] >= 65 && s[i] <=90) || (s[i] >= 97 && s[i] <= 122))
    		{
    			ns[j] = s[i];
    			j++;
    		}
    	}
    	ns[j] = '\0';
    	puts(ns);
    	
    	return 0;
    }
    
    

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        char s[100]={'\0'};
        int a=0;
        gets(s);
        a=strlen(s);
        for(int i=0;i<a;i++)
        {
            if(s[i]<65||(s[i]>90&&s[i]<97)||s[i]>122)
            {
                for(int j=i;j<a;j++){s[j]=s[j+1];}
                i--;
            }
            if(s[i+1]=='\0'){break;}
        }
        for(int i=0;s[i]!='\0';i++)
        {
            printf("%c",s[i]);
        }
        return 0;
    }
    
    
    • 1

    Information

    ID
    19538
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By