A1233 | [COCI-2011_2012-contest4]#4 KRIPTOGRAM
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Mirko intercepted an encrypted message. Mirko knows only that specific sentence was part of the original message. Find the first occurence of this sentence inside the encrypted message.
Message is encrypted by substituting every word from the original message with some (possibly the same one) word. If some word appears more than once in the original message, it will be substituted using the same word on each appearance. No two different words will have the same substitute word.
Words are space seperated sequences of lowercase letters. Sentence is a sequence of consecutive words.
Message is encrypted by substituting every word from the original message with some (possibly the same one) word. If some word appears more than once in the original message, it will be substituted using the same word on each appearance. No two different words will have the same substitute word.
Words are space seperated sequences of lowercase letters. Sentence is a sequence of consecutive words.
输入格式
The first line of input contains the encrypted message. This message will not contain more than 106 characters. There will be exactly one whitespace between adjacent words, and end of the line will be marked with $. Trailing $ is not considered to be a part of message.
The following line contains the sentence that appears in the original message, and which we must find in the encrpyted message. This sentence won’t be longer than 106 characters, and will follow the same format as described above.
The following line contains the sentence that appears in the original message, and which we must find in the encrpyted message. This sentence won’t be longer than 106 characters, and will follow the same format as described above.
输出格式
The first and only line of output should contain the index in the encrypted message of the first word in the first occurence of given original message sentence.
Solution will always exist.
Solution will always exist.
输入输出样例
输入 #1
a a a b c d a b c $ x y $
输出 #1
3
输入 #2
xyz abc abc xyz $ abc abc $
输出 #2
2
输入 #3
a b c x c z z a b c $ prvi dr prvi tr tr x $
输出 #3
3
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted