Exercise questions - Strings

Solve the following program without using string function

  1. Input string and find length
  2. Convert into lower/upper case
  3. Reverse the string
  4. Copy string
  5. Append string

Solve the following program, using string function

  1. Input 'ANKIT'
    Output:
    A
    AN
    ANK
    ANKI
    ANKIT
  2. Input two strings and swap.
  3. Solution: C

  4. Input string and find it is palindrome or not.
  5. Solution: C

  6. Input string and count number of vowels.
  7. Solution: C PHP

  8. Input string and count blank spaces, characters and words.
  9. Trim all the spaces in between the sentence.
  10. Solution: C

  11. Replace 2 or more blank spaces with a single blank space.
  12. Solution: C

  13. Input main string and a sub-string, WAP to find a sub-string from a main string.
  14. Input username and password and check username as 'admin' and password as 'admin123', username is not case-sensitive, but password is case-sensitive. If input is valid, give message welcome admin, otherwise display invalid.