#K45697. Subpath Verification

    ID: 27811 Type: Default 1000ms 256MiB

Subpath Verification

Subpath Verification

Given two file system paths, determine if the second path is a subpath of the first. In formal terms, for two strings (path1) and (path2), the condition for (path2) to be a subpath of (path1) is that after ensuring (path1) ends with a forward slash (i.e., appending '/' if necessary), (path2) must begin with (path1). For example, if (path1 = "/home/user/docs"), then (path2 = "/home/user/docs/reports") is a valid subpath whereas (path2 = "/home/user/music") is not.

This problem tests basic string manipulation and prefix checking.

inputFormat

The input is read from stdin. The first line contains the parent directory path (path1). The second line contains the potential subpath (path2).

outputFormat

Output a single line to stdout: print 'True' if (path2) is a subpath of (path1); otherwise, print 'False'.## sample

/home/user/docs
/home/user/docs/reports
True