func main() var a: int :: cui@inputInt() var b: int :: cui@inputInt() var map: dict :: #dict var i: int :: 0 while(true) var s: []char :: str(i) var hash: int :: getHash(s, a, b) var t: []char :: map.get(hash, &) if(t <>& null) do cui@print("\{s}\n") do cui@print("\{t}\n") ret end if do map.add(hash, s) do i :+ 1 end while func getHash(s: []char, a: int, b: int): int var res: int :: 0 for i(0, ^s - 1) do res :: (res * a + s[i] $ int) % b end for ret res end func func str(n: int): []char var res: []char :: "" while(n <> 0, skip) do res :~ ['a'.offset(n % 26)] do n :/ 26 end while ret res end func end func