'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();

STRING PRACTICE TEST.

 1. To reverse each word in the string

# You are using Python

n=input()

n=n.split(" ")

for i in n:

    j="".join(reversed(i))

    print(j,end=" ")

2. To check the string is anagrams or not

// You are using GCC

#include<stdio.h>

#include<string.h>

int main()

{

    char a[50],b[50];

    scanf("%s",&a);

    scanf("%s",&b);

    

    if(strlen(a)==strlen(b))

      printf("true");

    else

     printf("false");

    

}

No comments:

Post a Comment