petya love hockey one day watch hockey match fall asleep Petya dreamt appoint change hockey team thus Petya give original team w collection forbid substring s1s2sn all string consist uppercase lowercase latin letter String w length w character number 1 wFirst Petya find occurrence forbidden substring w string during search substring case letter should not taken consideration that string abc ABc consider equalafter Petya perform replacement letter cover occurrence More formally letter position replace position string w exist pair index lr 1lirw substre wlr contain collection s1s2sn case insensitive comparison during replacement letter case remain Petya allow replace letter are not cover forbid substringletter letter uppercase lowercase consider lucky hockey player that s petya perform change letter occur result string time possible help Petya find result string if string find come lexicographicallynote process replacement repeat occur that Petyas replacement string start contain new occurrence bad substring Petya pay attention