Exercise questions - Strings

  1. Input 'ANKIT'
    Output:
    A
    AN
    ANK
    ANKI
    ANKIT
  2. Input two strings and swap them using strcpy function. C
  3. Input string and find string is palindrome or not.
  4. void main()
    {
        char n[50], n2[50];
        printf("Enter name");
        gets(n);
        
        strcpy(n2,n);
        strrev(n2);
        
        if(strcmp(n,n2)==0)
        {
            printf("String is Palendrome");
        }
        else
        {
            printf("String is Not Palendrome");
        }
    }
  5. Input string and count number of vowels. C
  6. Input string and count blank spaces, characters and words.
  7. Trim all the spaces in between the sentence. C
  8. Replace 2 or more blank spaces with a single blank space. C
  9. Input main string and a sub-string, WAP to find a sub-string from a main string. Python
  10. Input username and password and check it, username is not case-sensitive, but password is case-sensitive.

Solve the following program without using string function

  1. Find String length
  2. Convert into lower/upper case
  3. Reverse the string
  4. Copy string
  5. Append string
  6. WAP to find input string is palindrome or not
  7. Count number of vowels using switch case.