Word CountingProblem code: WCOUNT |
All submissions for this problem are available.
Chef has decided to retire and settle near a peaceful beach. He had always been interested in literature & linguistics. Now when he has leisure time, he plans to read a lot of novels and understand structure of languages. Today he has decided to learn a difficult language called Smeagolese. Smeagolese is an exotic language whose alphabet is lowercase and uppercase roman letters. Also every word on this alphabet is a meaningful word in Smeagolese. Chef, we all know is a fierce learner - he has given himself a tough exercise. He has taken a word and wants to determine all possible anagrams of the word which mean something in Smeagolese. Can you help him ?
Input
Input begins with a single integer T, denoting the number of test cases. After that T lines follow each containing a single string S - the word chef has chosen. You can assume that 1 <= T <= 500 and 1 <= |S| <= 500. You can also assume that no character repeats more than 10 times in the string.
Output
Output one line per test case - the number of different words that are anagrams of the word that chef has chosen. As answer can get huge, print it modulo 10^9 + 7
Example
Input: 4 ab aa aA AAbaz Output: 2 1 2 60
Description: In first case "ab" & "ba" are two different words. In third case, note that A & a are different alphabets and hence "Aa" & "aA" are different words.
| Author: | yellow_agony |
| Date Added: | 17-01-2012 |
| Time Limit: | 3 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments

Fetching successful submissions

why i am keep getting RE. my
Same here ... SIGFPE is RE
same here.........
me too... it's giving wrong
Please read our FAQ:
Please read our FAQ: http://www.codechef.com/wiki/faq#Why_do_I_get_a_SIGFPE
I am also getting RE
@darkdiver. There are 26
Does modulo 10^9 +7 mean (x
modulo 10^9 +7 will mean (x
can you provide some test
i think runtime errors are
any sorts of word are always
@debjitbis08 : It means : x
@yosuke_fuji : Yes, all words
The input does not contain
String will contain only
i cannot submit my
Can answer exist in floating
Can any of the test case be
@gspinner not correct..
@cooltodinesh the output must
1 amjjdsjnnsakjkdass 67334369
@timegone plz answer:1
same here... :(
Discussing solutions,
@nikhil_adm you should give
The last sample test case
my code showing ans in no
here the character set is a-z
@admin m facing th same prob
@admin im gettin NZEC error
@admin now even im facin the
any completed experts plz
@admin: can u tell me plz why
what should I use, lld or
I don't understand, I have
@rijin, mY resuLt is
@bodmas, Yeah, I had had the
why i m getting runtime
@admin please help i m
@admin: pls see to it y it is
Come on, I tried my code with
@admin: exactly sample prblm
@admin i am getting runtime
this is so frUstrating. I'vE
max length of string is
I'm getting TLE. I looked up
this is so pathetic.i am
@pratishgupta91::Be CareFul
still WA....took care of
@admin submitted the problem
i submitted my solution, it