DCEPC810 - Cousin Wars
Sunny is fond of words. He got a new game to play with his cousin Sonali.He gives her a long string and two other smaller strings(A and B).Now he asks Sonali to find the number of all the subsequences of the long string that are greater than equal to smaller string A and less than equal to smaller string B.
Help Sonali to find the answer.
Note : Comparison of two strings is regarded same as that done by the string:compare function.
Empty string is not regarded as a subsequence.
Each input consists of 3 lines.First line has the TEXT string.
2nd and 3rd line contain two smaller strings A and B .
One number which gives the count such that
A <= subsequence of (TEXT) <= B
Input will consist of all lowercase characters.
1 <= Length of TEXT <= 25
1<= Length of A and B <= Length of TEXT
fc Output: 24
I felt if was a pretty easy problem. Not trivial by any means, but there should really be more AC submissions. Get to work people! :)
How could the answer ever be negative? If A>B (string::compare again) the result is simply 0.
@abbi031892 thnxLast edit: 2012-09-11 12:09:32
Don't print negative answers...make it 0
|Added by:||dce coders|
|Cluster:||Cube (Intel G860)|
|Languages:||ASM32-GCC MAWK BC C-CLANG C C++ 4.3.2 CPP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JAVA JS-MONKEY KTLN NIM NODEJS OBJC OBJC-CLANG OCT PICO PROLOG PYPY PY_NBC R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET|