Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

This challenge is to find the palindromic words from sentence(s). While finding the palindromic words from the sentence(s), the noise words should be removed if any is present in the sentence.

TSQL Beginners Challenge 16 - Find the palindromic words from the sentence(s)

TSQL Beginners Challenge 16 - Find the palindromic words from the sentence(s)

Sep 13 2010 2:09AM by Niladri Biswas   

Introduction

This challenge is to find the palindromic words from sentence(s). Palindrome is a word reading the same backward as forward. While finding the palindromic words from the sentence(s), the noise words should be removed if any is present in the sentence. There is a table "Noise" that defines Noise words

For e.g. MADAM is a palindrome but MADAM! is not. So we need to first remove noise character "!" from MADAM!

There are 2 tables in challenge. One contains the data from which we need to find the Palindromes and another contains noise words.

Sample Data

Table - Sentence

ID Sentence
-- -------------------------------
1  Hello Madam! how are you Madam?
2  She peep through the window
3  This is without any Palindrome

Table - Noise

ID Noise
-- -----
1  ?
2  !

Expected Results

ID Sentence			               PalindromeFound PalandromicWords FoundAt
-- ------------------------------- --------------- ---------------- -------------
1  Hello Madam! how are you Madam? 2		       Madam		    Position : 2,6
2  She peep through the window	   1		       peep		        Position : 2
3  This is without any Palindrome  0		       NULL		        NULL

Rules

  1. ID should be sorted in Ascending Order.
  2. The program should run in SQL SERVER 2005 and above.
  3. If no palindrome found in the sentence, then PalindromeFound column will be 0,PalandromicWords and FoundAt column will be NULL.
  4. The output should be in the same way as it has been shown. Column names should be exactly the same and the result must be sorted in Ascending order of ID.

Sample Script

Use the following script to generate the sample data.

DECLARE @Sentence TABLE(ID INT IDENTITY, Sentence VARCHAR(1000))
INSERT INTO @Sentence(Sentence)
SELECT 'Hello Madam! how are you Madam?' UNION ALL 
SELECT 'She peep through the window' UNION ALL 
SELECT 'This is without any Palindrome'

SELECT * FROM @Sentence

DECLARE @Noise TABLE(ID INT IDENTITY, Noise VARCHAR(10))
INSERT INTO @Noise(Noise)
SELECT '?' UNION ALL 
SELECT '!'

SELECT * FROM @Noise

Restrictions

  1. The solution should be a single query that starts with a "SELECT" or “;WITH”.

Notes

Tags:Puzzles, TSQL Beginners Challenge, TC, TSQL Beginners Challenge 16

Niladri Biswas
7 · 21% · 6710
TSQL Beginners Challenge 16 - Find the palindromic words from the sentence(s) , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]