BFSTR1 - Strchr in BF
Wonder if string functions are possible in brainf**k? Well, as Rivu says, "Impossible is nothing!!!".
Given a character (lower or upper case letter) and a character string, your task is to find the first occurance of the given character in this string and print its index. For a string of length N, the index numbering starts from 1 to N. Simple, Isn't it? Only 256 bytes allowed. Still simple? Well, try and minimize it.
Input
First line of the input contains T , which comprises of 2 digits, representing the number of test cases. The next T lines of the input contain a test case each.
Each of these lines start with a character, say C, followed by a space and then a string of characters, say STR. Each line of the input ends with a newline character.
Contraints:
0 < T < 10
0 < length of STR < 10
Output
For every test case, output the INDEX of the first occurence of C in STR. If the character C is NOT found in STR, output 0.
Example
Input:
03
F BrianFuck
c strcmp
m mama
Output:
6
4
1
SCORE is your source length.
NOTE: This question does NOT use exact judge. So, you can print any space character between the test cases.
hide comments
Sandeep Garhwar:
2014-05-28 19:18:39
I am hoping t!=10 in the new test file,my 210 byte code isn't getting accepted,could you help me know where i am going wrong?
|
Added by: | [theMighty] Deathsurgeon |
Date: | 2014-05-26 |
Time limit: | 1s |
Source limit: | 256B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | BF |
Resource: | Own problem |